Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Nouyana
Krool, please help me figure out how the ListBackColor and IntegralHeight properties work. I tried to use them with different operating systems and with different font sizes. There were no effect.
The ListBackColor is only in effect when the UseListBackColor property is set to True. (will return list back color brush on WM_CTLCOLORLISTBOX only when UseListBackColor is True, default is False)
What you mean with IntegralHeight ?
I think you mix up things. MSDN says about CBS_NOINTEGRALHEIGHT (equivalent of .IntegralHeight = False then CBS_NOINTEGRALHEIGHT is set) Specifies that the size of the combo box is exactly the size specified by the application when it created the combo box. Normally, the system sizes a combo box so that it does not display partial items.
That means the Height (!) of the drop-down list box area, not the width.
If you want to have the big size text fit into the drop-down area then try:
A) .HorizontalExtent = .GetIdealHorizontalExtent()
B) .DropDownWidth = .GetIdealHorizontalExtent() + Me.ScaleX(4, vbPixels, Me.ScaleMode) ' small extra buffer to account border widths etc.
Option A) uses CB_SETHORIZONTALEXTEND API.
MSDN: If the width of the list box is smaller than this value, the horizontal scroll bar horizontally scrolls items in the list box. If the width of the list box is equal to or greater than this value, the horizontal scroll bar is hidden or, if the combo box has the CBS_DISABLENOSCROLL style, disabled.
You can use the .DisableNoScroll property to control whether CBS_DISABLENOSCROL is set or not.
Option B) uses CB_SETDROPPEDWIDTH API.
MSDN: By default, the minimum allowable width of the drop-down list box is zero. The width of the list box is either the minimum allowable width or the combo box width, whichever is larger.
The .GetIdealHorizontalExtent() function is a convenient wrapper which calculates the "best" width, accounting possible WS_VSCROLL style and testing the string widths using the selected font.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Krool
What you mean with IntegralHeight ?
I think you mix up things. MSDN says about CBS_NOINTEGRALHEIGHT (equivalent of .IntegralHeight = False then CBS_NOINTEGRALHEIGHT is set) Specifies that the size of the combo box is exactly the size specified by the application when it created the combo box. Normally, the system sizes a combo box so that it does not display partial items.
That means the Height (!) of the drop-down list box area, not the width.
Krool, thanks for the detailed answer. I really mixed things up, and you helped me figure it out. But now I still want to understand how the standard IntegralHeight property works
For example, when I increase the .Font.Size at runtime, the .Height also increases. This is independent of the .IntegralHeight value. How can I see the "partial items"?
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Nouyana
Krool, thanks for the detailed answer. I really mixed things up, and you helped me figure it out. But now I still want to understand how the standard IntegralHeight property works
For example, when I increase the .Font.Size at runtime, the .Height also increases. This is independent of the .IntegralHeight value. How can I see the "partial items"?
IntegralHeight set to True just makes sure the items are completely visible, so the Height is always 'rounded' to a full item visible, so if you increase the size of the font it will adjust the height with it. Set it to False if you don't want that, the Height will be as you've set it.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Nouyana
I thought so. But it just doesn't work this way.
Oh, you're talking about the combobox? sorry I only thought about the listbox. As far as I know, the combobox is always integral height, just like it also doesn't seem to acknowledge 3D on/off (at least not with the standard VB version).
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by SuperDre
Oh, you're talking about the combobox? sorry I only thought about the listbox. As far as I know, the combobox is always integral height, just like it also doesn't seem to acknowledge 3D on/off (at least not with the standard VB version).
But the property is exist. Let's wait for the Krool's answer.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Nouyana
But the property is exist. Let's wait for the Krool's answer.
Depends on the combobox style. Only one of the styles supports IntegralHeight=False.
As for the LimitToList of Access? Isn't that what combobox Style 2 is?
Insomnia is just a byproduct of, "It can't be done"
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by LaVolpe
Depends on the combobox style. Only one of the styles supports IntegralHeight=False.
Are you talking about SimpleCombo style? Without any list at all?
Originally Posted by LaVolpe
As for the LimitToList of Access? Isn't that what combobox Style 2 is?
I usually use Style 2. Style 0 is more flexible (you can make it autofill aware or filter the list during user typing), but user can put there any garbage and leave the control.
Re: CommonControls (Replacement of the MS common controls)
No, style 1. Try it. Set IntegralHeight = False, increase the size of the comboxbox in design. In form load, add your items, you'll notice partial items are shown. Style 1 is like a hybrid comboxbox + listbox.
With Krool's control, you can turn AutoSelect on (Style 0) which will update the ListIndex property if the user selected something in the list, ListIndex is not -1 else it is -1. Check that property.
Insomnia is just a byproduct of, "It can't be done"
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by LaVolpe
No, style 1. Try it. Set IntegralHeight = False, increase the size of the comboxbox in design. In form load, add your items, you'll notice partial items are shown. Style 1 is like a hybrid comboxbox + listbox.
Thank you! Yes, the last item is partial. The ItemHeight property allows me to see all "partial items".
Originally Posted by LaVolpe
With Krool's control, you can turn AutoSelect on (Style 0) which will update the ListIndex property if the user selected something in the list, ListIndex is not -1 else it is -1. Check that property.
Selecting something in the list manualy is not realy the AutoSelect. User can leave the control without any clicking.
Last edited by Nouyana; Sep 15th, 2020 at 08:37 AM.
Re: CommonControls (Replacement of the MS common controls)
Can anyone please explain what the PictureAndCaption property is for? Under Windows XP without comctl32.dll v.6.1 everything works fine without this property.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Nouyana
Can anyone please explain what the PictureAndCaption property is for? Under Windows XP without comctl32.dll v.6.1 everything works fine without this property.
The PictureAndCaption property is meaningful only when the style property is 0 - Normal.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Nouyana
Error with TextBoxW.OverTypeMode property
I cannot replicate your problem. I just tested AllowOverType property (which toggles OverTypeMode property upon Insert key) and it worked.
Please bundle a demo showing the issue. Thanks
Originally Posted by Nouyana
When can this be useful? Why not just use style 1?
Style 1 - Graphical implies the BS_OWNERDRAW window style. It's just another possibility to have picture and caption without depending on BS_OWNERDRAW.
Originally Posted by Nouyana
why the AutoSelect property of ComboBox doesn't work when the control isn't dropped down? Was it intended?
I don't know what you mean exactly. When I set the ComboBoxW1 style to 0 - DropDownCombo in the ComCtlsDemo project and I type 'charlie' it automatically becomes 'Charlie' without using the dropdown. So for me it is working. (the ListIndex is updated)
Again please provide demo so I can look what the problem is.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Krool
I don't know what you mean exactly. When I set the ComboBoxW1 style to 0 - DropDownCombo in the ComCtlsDemo project and I type 'charlie' it automatically becomes 'Charlie' without using the dropdown. So for me it is working. (the ListIndex is updated)
Again please provide demo so I can look what the problem is.
I have tested the AutoSelect property under:
1. WinXP SP3 with comctl32.dll versions 5.82.2900.6028 and 6.0.2600.0
2. Win10 x64
It was ComCtlsDemo project from v1.7.0.0
I tried two experiments. The first one:
1. I made the ComboBoxW1 dropped down (style 0)
2. I typed "char" in the text field of ComboBoxW1
3. I pressed the Tab key on my keyboard
4. The text field was filled automatically and the ListIndex was updated
The second experiment:
1. I made the ComboBoxW1 closed up (style 0)
2. I typed "charlie" in the text field of ComboBoxW1
3. I pressed the Tab key on my keyboard
4. The text field was NOT changed automatically and the ListIndex = -1
Originally Posted by Krool
I cannot replicate your problem. I just tested AllowOverType property (which toggles OverTypeMode property upon Insert key) and it worked.
Please bundle a demo showing the issue. Thanks.
Here it is. Tested under WinXP SP3 with comctl32.dll version 5.82.2900.6028
CCRP v1.7.0.0
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Nouyana
I have tested the AutoSelect property under:
1. WinXP SP3 with comctl32.dll versions 5.82.2900.6028 and 6.0.2600.0
2. Win10 x64
It was ComCtlsDemo project from v1.7.0.0
I tried two experiments. The first one:
1. I made the ComboBoxW1 dropped down (style 0)
2. I typed "char" in the text field of ComboBoxW1
3. I pressed the Tab key on my keyboard
4. The text field was filled automatically and the ListIndex was updated
The second experiment:
1. I made the ComboBoxW1 closed up (style 0)
2. I typed "charlie" in the text field of ComboBoxW1
3. I pressed the Tab key on my keyboard
4. The text field was NOT changed automatically and the ListIndex = -1
The ComboBoxW1 in the ComCtlsDemo project has AutoSelect property as False. Please ensure to set it to True.
Originally Posted by Nouyana
Here it is. Tested under WinXP SP3 with comctl32.dll version 5.82.2900.6028
CCRP v1.7.0.0
I could replicate it on Windows XP, but not on Windows 10.
The root cause is that there is an access violation when the edit control receives EM_REPLACESEL with a null pointer.
The RichEdit control does not crash with a null pointer and EM_REPLACESEL.
My guess is that after Windows XP there was a fix so that a null pointer in EM_REPLACESEL does not crash anymore the edit control.
I have noted this down and will probably soon make a fix that kinda looks like following for the SelText property:
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Krool
The ComboBoxW1 in the ComCtlsDemo project has AutoSelect property as False. Please ensure to set it to True.
Oh, yes. You are right. I forgot it. But the problem is exist. When you type "charlie", it becomes "Charlie". But when you type "char", the behavior depends on the DroppedDown state. As I understand, this is not the problem of AutoSelect property. It would be nice if "Char" always became "Charlie".
Last edited by Nouyana; Sep 21st, 2020 at 02:29 PM.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Nouyana
Oh, yes. You are right. I forgot it. But the problem is exist. When you type "charlie", it becomes "Charlie". But when you type "char", the behavior depends on the DroppedDown state. As I understand, this is not the problem of AutoSelect property. It would be nice if "Char" always became "Charlie".
In a dropped down state the additional search kicks in by windows.
So all normal and no issue here.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Krool
I could replicate it on Windows XP, but not on Windows 10.
The root cause is that there is an access violation when the edit control receives EM_REPLACESEL with a null pointer.
The RichEdit control does not crash with a null pointer and EM_REPLACESEL.
My guess is that after Windows XP there was a fix so that a null pointer in EM_REPLACESEL does not crash anymore the edit control.
I have noted this down and will probably soon make a fix that kinda looks like following for the SelText property:
Code:
If StrPtr(Value) = 0 Then Value = ""
I quote myself now.. This fix has been applied now.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Nouyana
Krool, how does the FontCombo.BuddyControl property work? What kind of control should I use with this property?
The FontCombo.BuddyControl can only buddy another FontCombo control.
Means the first one has the font names and the buddied second One FontCombo the font sizes respectively.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Krool
The FontCombo.BuddyControl can only buddy another FontCombo control.
Means the first one has the font names and the buddied second One FontCombo the font sizes respectively.
Re: CommonControls (Replacement of the MS common controls)
What about the VBFlexGrid.HitTest? This is a Sub, not a Function. But it should "return a value which indicates the element located at the specified X and Y coordinates."
The same question about the ComputeControlSize method of the ListView and MonthView controls.
Last edited by Nouyana; Sep 28th, 2020 at 07:44 AM.
Reason: Added
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Nouyana
What about the VBFlexGrid.HitTest? This is a Sub, not a Function. But it should "return a value which indicates the element located at the specified X and Y coordinates."
The same question about the ComputeControlSize method of the ListView and MonthView controls.
VBFlexGrid.HitTest is a Sub. The return values are stored as property .HitResult/.HitRow/.HitCol.
ComputeControlSize is also a Sub. The params are passed ByRef. So use variables.
Re: CommonControls (Replacement of the MS common controls)
I don't know is this intended or not behaviour, but...
Monthview does not refresh correctly, when multiple months are shown and selection extends to month(s) over leftmost month, which are not shown after mouseleave event.
Select range extending to second and or third month displayed.
After MouseLeave and MouseEnter events, monthview draws only leftmost month date range selection.
Re: CommonControls (Replacement of the MS common controls)
Krool, Im adding column headers and then items to the listview in report mode on form load. Im getting a Itemclick then an ItemSelect event as the first listItem is added before any following columns are even filled out or the listview is visible or the form is fully loaded. This makes my click and select code fail because of incomplete information. Is this a bug or intended behavior? I can set a flag to delay processing till initial load is done if needed but was curious...
Re: CommonControls (Replacement of the MS common controls)
Hi Krool
My question is about DTPicker
I want to know if possible to automatically move to next datepart.
I mean selection focus moves to months (mm) after having entered the the days (dd).
And move to the year(yyyy) part once the month is entered or vice versa.
thank you
Last edited by Mustaphi; Oct 15th, 2020 at 03:45 AM.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by vbLewis
Krool, Im adding column headers and then items to the listview in report mode on form load. Im getting a Itemclick then an ItemSelect event as the first listItem is added before any following columns are even filled out or the listview is visible or the form is fully loaded. This makes my click and select code fail because of incomplete information. Is this a bug or intended behavior? I can set a flag to delay processing till initial load is done if needed but was curious...
The ItemSelect event is intended. The V6 MS.ListView behaves the same.
However, the V5 MS.ListView behaves different.
You can make the AutoSelectFirstItem property set to False (mimic V5 MS ListView behavior), then there will be no ItemSelect event fired when adding the first item. (but it is also not selected, only focused)
The ItemClick event is not fired on my side. Can you share a demo showing this ? The ListView control only raises ItemClick upon NM_CLICK, NM_RCLICK. So this should not happen during the feed of a ListView. I cannot replicate that issue for you..
Originally Posted by Mustaphi
My question is about DTPicker
I want to know if possible to automatically move to next datepart.
I mean selection focus moves to months (mm) after having entered the the days (dd).
And move to the year(yyyy) part once the month is entered or vice versa.
thank you
There is no straight forward dedicated message for that. However, you can trick the DTPicker in doing so.
move focus to the right
Re: CommonControls (Replacement of the MS common controls)
you can trick the DTPicker in doing so
I tested the trick but with no success
I used the code in change event and in key down event but it did not work as expected.
Anyway thank you very much
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Krool
The ItemSelect event is intended. The V6 MS.ListView behaves the same.
However, the V5 MS.ListView behaves different.
You can make the AutoSelectFirstItem property set to False (mimic V5 MS ListView behavior), then there will be no ItemSelect event fired when adding the first item. (but it is also not selected, only focused)
The ItemClick event is not fired on my side. Can you share a demo showing this ? The ListView control only raises ItemClick upon NM_CLICK, NM_RCLICK. So this should not happen during the feed of a ListView. I cannot replicate that issue for you..
Krool,
Thanks for your reply. The AutoSelectFirstItem option fixed the problem. The reason i was also getting a Click event was because i was redirecting all Select() events to the Click() event. woops!
regards,
Lewis