Concerning this the VB.TextBox has the same issue. So this is a "new" MS bug.
VB.TextBox Appearance must be set to 0 - Flat.
Attachment 188014
Printable View
Concerning this the VB.TextBox has the same issue. So this is a "new" MS bug.
VB.TextBox Appearance must be set to 0 - Flat.
Attachment 188014
VB6SP6, Win10 (latest), VBCCR 1.7.49
@Krool
i found a small bug using the ProgressBar in the IDE:
the displayed text in the ProgressBar is not redrawed when changing the font.
I have to change the text property to force a redraw with the new font settings.
Nothing critical but i guess easy to fix ;-)
Update released.
I modified OLEGuids.tlb and VTableHandle.bas once again. (VTableHandle.bas is now x64 aware)
All LPSTR and LPWSTR got replaced to LONG StrPtr() so that the VB6 code base will be the same when transition to twinBASIC. (x86 or x64)
In x64 we cannot re-compile OLEGuids.odl as MIDL does not allow it. So it must be done via twinBASIC Package (OLEGuids.twin) which works great but does not support LPSTR and LPWSTR.. That's why it needed to be replaced to LONG in OLEGuids.tlb that in twinBASIC we can define LongPtr in the OLEGuids.twin package.
Sorry for the inconvenience caused.
Update released.
Fixed const FR_HIDEMATCHCASE from &H8000 into &H8000&.
Thanks to NBechtloff who made it possible to modify the type lib in VBCCR17.OCX so it could be re-compiled with "binary compatibility".
@Krool
The ComboBoxW does have a BackColor & ForeColor property to change the text display of the dropdown list but the ImageCombo control doesnt have them.
Have you forgotten to add these properties or is there another reason why they dont exist?
Do you have any idea how to change the BackColor & ForeColor property of the ImageCombo control?
You can't change them in ImageCombo.
The ImageCombo is basically a super-classed ComboBox.
The items are owner-drawn by MS and they hard-coded the fore color and background color.
So I guess through hacks and API redirection it's possible but that should be done by the app and not by a OCX.
At one machine I get this error:
VBCCR17:
Run-time error -2147221164 (80040154)
What could that be?
Any idea how to solve this?
This occurs in the _Initialize routine of an user control, with VBCCR17.LabelWs, VBCCR17.CommandButtonWs and one VBCCR17.TreeView, VB.Images
@Chris_G33
Search this thread for "-2147221164" and you will see i had the same problem with the older version of VBCCR1.6.
I used the OCX with SxS (Side-by-Side) but i had to manually registering the OCX on the system to fix this error.
@Krool
Im working on a Dark Mode for the VBCCR controls, see https://www.vbforums.com/showthread....e-amp-VB6-apps
The themed CheckBox and the Option control doesnt support the change of the forecolor so i started to ownerdraw the controls.
Currently i draw the checkbox symbol themed and the text with the control forecolor.
However, I have a problem with hottracking (moving the mouse over the checkbox) because this does not trigger the OwnerDraw event and therefore the checkbox cannot be drawn with CBS_UNCHECKEDHOT/CBS_CHECKEDHOT.
Can you change this and trigger the OwnerDraw event when a mouse hottracking occurs?
Another general problem with owner draw controls is that they are invisible in the IDE and you lose track of the controls on a form. Could this be changed somehow so that the owner draw controls are still displayed normally in the IDE?
IDE:
Attachment 188269
Started App:
Attachment 188270
Dark Mode:
Attachment 188271
@Krool
MS doesnt send the state ODS_HOTLIGHT when the mouse enters, moves or leaves the control.
A solution is to trigger the ownerdraw event at the current existing events "MouseEnter" and MouseLeave" to redraw the checkbox with CBS_UNCHECKEDHOT/CBS_CHECKEDHOT and the option control with RBS_UNCHECKEDHOT/RBS_CHECKEDHOT.
Please can you add this with the next update for the checkbox and optionbutton control?
Attachment 188313Attachment 188314
Attachment 188315Attachment 188316
Sorry, .Refresh within MouseEnter/MouseLeave doesnt trigger the OwnerDraw event and i guess it would not set the state to ODS_HOTLIGHT to draw the highlighted checkbox.
A solution would be to extend the OwnerDraw event parameters with "byval MouseEnter as boolean = false" and "byval MouseLeave as boolean = false" to simulate the control state ODS_HOTLIGHT. You could trigger the OwnerDraw event after "RaiseEvent MouseEnter" and "RaiseEvent MouseLeave" in the code. But im not sure how you get the necessary information for the other OwnerDraw event parameters at this point...
We don't need WM_DRAWITEM to include ODS_HOTLIGHT.
Since I already have a "MouseOver" state I could simply add that state when passing to the OwnerDraw event.
What I don't understand is your point that a .Refresh upon MouseEnter will not trigger an OwnerDraw.
Anyway, I could add an invalidation on that one automatically in the step when adding ODS_HOTLIGHT also.
Give me little bit time until it's added.
If we only use "MouseOver" and the user moves the mouse pointer outside the control how can the control be updated and redrawn with the normal checkbox?
Using "MouseEnter" will ensure to draw the "hot-checkbox" and MouseLeave will ensure to draw the normal checkbox again.
My code:
a .Refresh doesnt call the OwnerDraw sub.Code:Private Sub chkOwnerdraw_MouseEnter()
chkOwnerdraw.Refresh
End Sub
Private Sub chkOwnerdraw_MouseLeave()
chkOwnerdraw.Refresh
End Sub
Private Sub chkOwnerdraw_OwnerDraw(ByVal Action As Long, ByVal State As Long, ByVal hDC As Long, ByVal Left As Long, ByVal Top As Long, ByVal Right As Long, ByVal Bottom As Long)
Call OwnerDraw_CheckBox(chkOwnerdraw, Action, State, hDC, Left, Top, Right, Bottom)
End Sub
No.
Ok, with MouseTrack=True the Refresh command was executed and the OwnerDraw event called.
Can you add something like this to the WindowProcControl in your code:
This would help to handle the display of the HOT-tracking and the focus rectangle too.Code:Private Function WindowProcControl(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
...
RaiseEvent MouseEnter
if DrawMode=1 then
RaiseEvent OwnerDraw(...)
end if
...
RaiseEvent MouseLeave
if DrawMode=1 then
RaiseEvent OwnerDraw(...)
end if
End Function
Update released.
ODS_HOTLIGHT added to the OwnerDraw event in the CommandButtonW/CheckBoxW/OptionButtonW.
Condition is that the MouseTrack property is set to True.
Invalidation occurs automatically on MouseEnter/MouseLeave when DrawMode is set to OwnerDraw. So no manual .Refresh needed on those two events.
But again, MouseTrack property must be set to True.
Good job and nice solution!
HOTLIGHT works now:
Attachment 188330
Krool,
Your latest update to ComCtlsDemo will not run. It compiles but when run gives the following error:
Run-time error '438'
Object doesn't support this property or method
Debug takes me to line 517 VTableHandle.bas, line 517
IDispatch.GetIDsOfNames IID_NULL, StrPtr(MethodName), 1, 0, GetDispID
where MethodName is 'MousePointer' and GetDispID = -1
Not sure if this is different with Krool's common controls vs. the Microsoft ones, but since I'm happily using Krool's, I thought to post the question here.
Situation:
On a form I have a textbox with code in the LostFocus event, and the OK button set as the Default. Everything works fine when navigating the form with the mouse, but when the user hits the <Enter> key to confirm the input, the code immediately jumps to the OK-button code, ignoring the LostFocus event on the textbox.
How can I make sure that the code in LostFocus event ofthe textbox is executed before the code behind the OK-button?
I can confirm this problem. Pressing enter in a textbox doesnt trigger the LostFocus event but triggers the MouseClick event on the default CommandButtonW. I've tested this with the MS controls and they behave the same way!
I tried a workaround by using the CausesValidation property but the Validate-event doesnt trigger too.
Maybe Krool can fix this...
I have a form with several CCR controls, the VBFlexgrid by Krool, and the SSTabEx by Eduard. I use MyForm.Show vbModal to show it. So far nothing special, and pretty much like several other forms in my app.
Now the strange part:
- Calling it from the CCR Toolbar, it shows directly
- Calling it from a popup menu, it shows directly
- Calling it from the VB6 menu, it doesn't come up until the mouse is moved over the toolbar, status bar, or the edge of the main form.
There is no difference between the three calling routines, and other forms with exactly the same properties work correctly in all three calling methods.
I've also tried to fix the issue with a forced redraw, but that didn't help.
Code:Private Sub Form_Activate()
Me.Refresh
MyTab.Refresh
MyGrid.Refresh
MyTextBox.SetFocus
End Sub
What could be the case?
The sources for all VBCCR controls are now x64 aware. Which means it can be imported into twinBASIC "as-is" and run under the x64 compiler.
There is now a VBCCR17 package available. So it makes it easy to include.
Attachment 188476
INFO: The errors are probably related to OLEGuids. You can't use the OLEGuids.tlb (32-bit), instead reference to the OLEGuids twinPackage. (OLEGuids.twin)
Also, for the time being, you have to move it up to the top of the list with the arrows on the side.
Thanks, works now.
@Krool
I found a small bug using the FindItem command of the ListBox:
For example: a listbox contains an item with the name "ListBox Item 01".
Using FindItem("ListBox", 0, True) returns the ListIndex 0. (OK)
Using FindItem("Box", 0, True) returns the ListIndex -1. (WRONG)
Setting the parameter partially=true should also find "Box" inside the item name.
"maybe" i found a ListView bug (or feature?):
every time when i do a mouse click in the listview control and NOT moving the mouse the MouseMove event is triggered too.
i tested this with the external USB mouse and the integrated laptop mouse pad.
why is the MouseMove event triggered without moving the mouse?
Hello. I'm trying to put a Cyrillic string in the TreeView. But instead of text, garbage is displayed.
After all this control supports Unicode? What am I doing wrong?
Code:TreeView1.Nodes.Add , , "ROOT", "HELLO ПРИВЕТ!"
Attachment 188574
Although the control may support Unicode, the IDE does not. You can either load the Unicode text from a file or build up the string one character at a time using ChrW$.
In addition to VanGoghGaming's suggestion, you can quickly test this by adding a TextboxW object on the form, entering the Cyrillic text there, and then adding the node to the treeview referring the the TextBox.Text property. E.g. by adding the Add code behind a button. But this too will only work at runtime, due to the limitations of the IDE.
I can confirm that the TreeView (and all other controls from Krool) properly support Unicode strings, as I have tested this with Cyrillic (Russian), Korean and Thai. Works without a problem on a PC with Windows in e.g. English, Dutch or French.
Be aware that the "wonderful world" of Unicode, UTF-8 with or without BOM comes with quite a few challenges. Krool's Common Controls make it a lot easier, but for things like the Window's captions, menu's, and popup menu's quite a bit of "trickery" is needed. Fortunately there is good information about this available on VBForums, among others from people like LaVolpe, fafalone, Elroy, Eduardo and then I surely forget some.
Hey, you know what they say, no pain, no gain! ;)
If you need to use many such strings then it makes sense to put them in a file that you can include in a "Resource" or even packed in a "Bitmap" loaded in an Image control. Then you can extract them all at runtime in the "Form_Load" event or something.
Someone (maybe me) needs to develop an Add-In that's nothing but a Unicode textbox UI with an "OK" button. But then, the problem is, what to do with the Unicode string when "OK" is clicked. I suppose we could build one of those ChrW$() & ChrW$() ... strings and put it into the clipboard. But it'd be really cool if a way could be found to directly store the Unicode string in the source code (which are written as ANSI). Maybe that ChrW$() statement would be enough, possibly having an option on the Add-In to translate back to a Unicode string for viewing.
IDK, just brainstorming of a better way to do this.
Conversion to Base64 is another way to store Unicode strings in ANSI text.
Select the proper Font.Charset.
What value do you set in the "Font.Charset" property? You don't know what language the user is typing in the Unicode Textbox. Can you show an example using this property? I've never used it before...
In my apps I allow the user to select a font to be used for the UI. I then apply the font properties including the Charset to all applicable controls.
Not sure if this is a bug / limitation / not really important / something that can be done in a much smarter way, but thought to mention it since I had a bit of a headache about it today...
I'm using a multi-line textbox to get an idea of how much space I should allow for text to be displayed in a grid. The steps are:
1. Set the width of the textbox.
2. Assign the various font properties.
3. Set the text.
4. Use the TextHeight property of the form to learn the height of each line.
5. Use SendMessage(myTextBox.hWnd, EM_GETLINECOUNT, 0&, 0&) to get the number of lines from the textbox.
6. Multiply line height with number of lines to know the row height.
This workes perfectly fine with a normal textbox, but with the TextBoxW it always returns 1 for the number of lines.
I have no problems to get the line count with a TextBoxW (multiline=true). Maybe your declarations are wrong?
My code:
Code:Public Const EM_GETLINECOUNT As Long = &HBA&
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
LineCount = SendMessage(txtPrompt.hWnd, EM_GETLINECOUNT, 0, 0)
The declarations are exactly the same, so that can't be the issue. I've been tweaking various other things, and now do get a linecount larger than 1 returned. However, it's a much larger number than it should be. E.g. instead of 3 lines, it returns 12... Overall it seems off by a factor 3-4.
I set the width of the textbox based on the sum of the width of 4 VBFlexGrid columns. Could it be that the TextBoxW interprets this number differently than the original TextBox?
See https://learn.microsoft.com/en-us/wi...m-getlinecountQuote:
If the Wordwrap feature is enabled, the number of lines can change when the dimensions of the editing window change.
wrong post
Hello Nouyana!
Thank you for providing the "GetVbDescr. bas" and "SetVbDescr. bas" modules. With these modules, I can quickly translate the "VB-Description" content of Krool's controls into the language I use. This is very convenient and greatly helps me solve the difficulty of reading English. I believe this module will also be of great help to others who do not understand English very well.
I'm not sure if you have already resolved the issue of language translation efficiency that you mentioned. I use an online translation API for machine translation. After the machine translation is completed, I manually check and correct it to ensure that there are no errors before updating it to the source file. More than 1000 lines of content can be translated in just a few minutes. After the new version of Krool's controls comes out, I often translate your modules.
microsoft translator:
https://learn.microsoft.com/en-us/az...opment-options
baidu translator:
http://api.fanyi.baidu.com/doc/21
Hello Nouyana!
GetVbDescr.bas and SetVbDescr.bas can be used in "*. cls and *. ctl" files to extract and set "VB_Description" content, but cannot handle ". pag and. frm" files.
If you want to add the extraction and setting of "Caption" in the ". pag and. frm" files for translation into the desired language, how should you adjust the code? Can you help implement this function? Thank you!
The VBFlexGrid control has a number of sorting options, allowing among others to differentiate between numeric sorting and string sorting. I couldn't find it, but is this option also available for the ListView control? I.e. have the sort return 1, 2, 3, 10, 25 instead of 1, 10, 2, 25, 3.