-
Jul 25th, 2023, 03:42 AM
#3561
Re: CommonControls (Replacement of the MS common controls)
 Originally Posted by Mith
My code:
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
a .Refresh doesnt call the OwnerDraw sub.
Do you have MouseTrack set to True?
-
Jul 25th, 2023, 06:43 AM
#3562
Hyperactive Member
Re: CommonControls (Replacement of the MS common controls)
 Originally Posted by Krool
Do you have MouseTrack set to True?
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:
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
This would help to handle the display of the HOT-tracking and the focus rectangle too.
-
Jul 25th, 2023, 03:09 PM
#3563
Re: CommonControls (Replacement of the MS common controls)
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.
-
Jul 25th, 2023, 08:01 PM
#3564
Hyperactive Member
Re: CommonControls (Replacement of the MS common controls)
 Originally Posted by Krool
Update released.
ODS_HOTLIGHT added to the OwnerDraw event in the CommandButtonW/CheckBoxW/OptionButtonW.
Good job and nice solution!
HOTLIGHT works now:
-
Jul 30th, 2023, 05:52 PM
#3565
Addicted Member
Re: CommonControls (Replacement of the MS common controls)
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
-
Jul 30th, 2023, 10:40 PM
#3566
Re: CommonControls (Replacement of the MS common controls)
 Originally Posted by MountainMan
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
You need to update OLEGuids.tlb
It was once again updated recently.
Reason was to change all LPWSTR to LONG so that the code works in x64 tB where then LongPtr works in OLEGuids.twin. (LPWSTR not possible)
-
Jul 31st, 2023, 05:16 PM
#3567
Addicted Member
Re: CommonControls (Replacement of the MS common controls)
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?
-
Jul 31st, 2023, 08:01 PM
#3568
Hyperactive Member
Re: CommonControls (Replacement of the MS common controls)
 Originally Posted by Erwin69
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...
-
Aug 1st, 2023, 03:52 AM
#3569
Addicted Member
Re: CommonControls (Replacement of the MS common controls)
 Originally Posted by Erwin69
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 found a simple workaround:
Start the code in the Defaul Button by giving it the focus. E.g.
Code:
btnOK.SetFocus = True
DoEvents
-
Aug 1st, 2023, 09:21 AM
#3570
Hyperactive Member
Re: CommonControls (Replacement of the MS common controls)
 Originally Posted by Erwin69
I found a simple workaround:
Start the code in the Defaul Button by giving it the focus. E.g.
Code:
btnOK.SetFocus = True
DoEvents
This triggers the LostFocus event of the textbox?
-
Aug 1st, 2023, 09:40 AM
#3571
Addicted Member
Re: CommonControls (Replacement of the MS common controls)
 Originally Posted by Mith
This triggers the LostFocus event of the textbox?
Yep.
-
Aug 4th, 2023, 04:51 AM
#3572
Addicted Member
Re: CommonControls (Replacement of the MS common controls)
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?
-
Aug 7th, 2023, 01:36 PM
#3573
Re: CommonControls (Replacement of the MS common controls)
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.
-
Aug 9th, 2023, 04:21 AM
#3574
Fanatic Member
Re: CommonControls (Replacement of the MS common controls)
 Originally Posted by Krool
means it can be imported into twinBASIC "as-is" and run under the x64 compiler.
Can you please provide step-by-step instructions for the uninitiated?
I am getting too many errors here, so I think I am doing it wrong in general somehow.
-
Aug 9th, 2023, 06:17 AM
#3575
Re: CommonControls (Replacement of the MS common controls)
 Originally Posted by Karl77
Can you please provide step-by-step instructions for the uninitiated?
I am getting too many errors here, so I think I am doing it wrong in general somehow.
There is now a VBCCR17 package available. So it makes it easy to include.

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)
Last edited by Krool; Aug 9th, 2023 at 06:42 AM.
-
Aug 9th, 2023, 08:46 AM
#3576
Re: CommonControls (Replacement of the MS common controls)
Also, for the time being, you have to move it up to the top of the list with the arrows on the side.
-
Aug 9th, 2023, 02:59 PM
#3577
Fanatic Member
Re: CommonControls (Replacement of the MS common controls)
-
Aug 10th, 2023, 08:53 AM
#3578
Hyperactive Member
ListBox FindItem Issue
@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.
-
Aug 10th, 2023, 12:02 PM
#3579
Re: ListBox FindItem Issue
 Originally Posted by Mith
@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.
It's not a bug..
If the constant used in the API call is LB_FINDSTRING, any partial match *beginning* with the entered string is located. If the constant LB_FINDSTRINGEXACT is used, then the entered text much match exactly the string in the listbox.
-
Aug 10th, 2023, 11:46 PM
#3580
Hyperactive Member
Re: ListBox FindItem Issue
 Originally Posted by Krool
It's not a bug..
ok, i understand, its a feature by MS :-)
i've written my own search routine using the classic InStr command.
-
Aug 13th, 2023, 08:07 PM
#3581
Hyperactive Member
MouseMove event is triggered without moving the mouse
"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?
-
Aug 27th, 2023, 03:22 PM
#3582
Junior Member
Re: CommonControls (Replacement of the MS common controls)
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 ПРИВЕТ!"
-
Aug 27th, 2023, 03:42 PM
#3583
Re: CommonControls (Replacement of the MS common controls)
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$.
-
Aug 27th, 2023, 03:57 PM
#3584
Addicted Member
Re: CommonControls (Replacement of the MS common controls)
 Originally Posted by Erwin69
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?
It's been a few weeks since I posted this. Does anyone have an idea what could cause the problem?
-
Aug 27th, 2023, 04:19 PM
#3585
Addicted Member
Re: CommonControls (Replacement of the MS common controls)
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.
-
Aug 27th, 2023, 04:50 PM
#3586
Junior Member
Re: CommonControls (Replacement of the MS common controls)
 Originally Posted by VanGoghGaming
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$.
Thanks, it works. But to form strings in this way is pain. 
Code:
Function Hello() As String
Hello = ChrW$(1055) & ChrW$(1056) & ChrW$(1048) & ChrW$(1042) & ChrW$(1045) & ChrW$(1058)
End Function
-
Aug 27th, 2023, 05:03 PM
#3587
Re: CommonControls (Replacement of the MS common controls)
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.
-
Aug 28th, 2023, 10:43 AM
#3588
Re: CommonControls (Replacement of the MS common controls)
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.
Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.
-
Aug 28th, 2023, 12:12 PM
#3589
Re: CommonControls (Replacement of the MS common controls)
Conversion to Base64 is another way to store Unicode strings in ANSI text.
-
Aug 28th, 2023, 02:38 PM
#3590
Re: CommonControls (Replacement of the MS common controls)
Select the proper Font.Charset.
-
Aug 28th, 2023, 04:30 PM
#3591
Re: CommonControls (Replacement of the MS common controls)
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...
-
Aug 28th, 2023, 05:11 PM
#3592
Addicted Member
Re: CommonControls (Replacement of the MS common controls)
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.
-
Sep 6th, 2023, 06:01 PM
#3593
Addicted Member
Re: CommonControls (Replacement of the MS common 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.
-
Sep 6th, 2023, 07:31 PM
#3594
Hyperactive Member
Re: CommonControls (Replacement of the MS common controls)
 Originally Posted by Erwin69
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)
-
Sep 7th, 2023, 03:49 AM
#3595
Addicted Member
Re: CommonControls (Replacement of the MS common controls)
 Originally Posted by Mith
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?
-
Sep 7th, 2023, 04:24 AM
#3596
Hyperactive Member
Re: CommonControls (Replacement of the MS common controls)
If the Wordwrap feature is enabled, the number of lines can change when the dimensions of the editing window change.
See https://learn.microsoft.com/en-us/wi...m-getlinecount
-
Sep 7th, 2023, 01:55 PM
#3597
Re: CommonControls (Replacement of the MS common controls)
-
Sep 16th, 2023, 05:53 AM
#3598
Lively Member
Re: CommonControls (Replacement of the MS common controls)
 Originally Posted by Nouyana
For me personally, translation is a way of learning. There are many new features in Krool controls. I hope it will keep my time in the future.
I think it will take me about three weeks to translate 1,390 descriptions. If someone helps me it will be faster.
As I said, I want to create a documentation for the controls. Object browser shows only 5% of what I need (no examples, no restrictions, no tips). Of course, I cannot cope with this task alone. So, you may help me (programmatically creating a help file from vbccr.mdb, for example). I also want to add the examples from ComCtlsDemo.vbp to the help file. Maybe it'll be better to create a wiki-project for that purposes. Are you in?
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
-
Sep 16th, 2023, 09:49 AM
#3599
Lively Member
Re: CommonControls (Replacement of the MS common controls)
 Originally Posted by Nouyana
Thank you. I am working on translation of your control's descriptions into Russian. I am using the official Russian help file for VB5. Look at theese files, may be you will find them useful:
GetVbDescr.bas
This is a ready to use program (Sub Main) without GUI. It creates an mdb database with descriptions of the control's subs, events, properties, etc. All you need to use it is to set up the sSrcPath constant (path to "Builds" folder) and run it. The program will create a vbccr.mdb database with all the descriptions.
SetVbDescr.bas
This program will replace the VB_Description with value from vbccr.mdb (t_DESCR.SUB_TRANSL field). All you need to use it is to set up the sSrcPath constant.
vbccr.pdf
This is a standard Microsoft Access report. Somebody can use it as a help file.
I will improve this program in the future. I want to add a GUI. So we will be able to automatically translate descriptions within the new versions of controls.
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!
-
Oct 3rd, 2023, 08:52 AM
#3600
Addicted Member
Re: CommonControls (Replacement of the MS common controls)
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|