Page 74 of 74 FirstFirst ... 246471727374
Results 2,921 to 2,947 of 2947

Thread: CommonControls (Replacement of the MS common controls)

  1. #2921

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,617

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Nouyana View Post
    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.
    Last edited by Krool; Sep 13th, 2020 at 08:06 AM.

  2. #2922
    Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    37

    Arrow Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    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"?

  3. #2923
    Addicted Member
    Join Date
    Mar 2009
    Posts
    203

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Nouyana View Post
    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.

  4. #2924
    Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    37

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by SuperDre View Post
    Set it to False if you don't want that, the Height will be as you've set it.
    I thought so. But it just doesn't work this way.

  5. #2925
    Addicted Member
    Join Date
    Mar 2009
    Posts
    203

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Nouyana View Post
    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).

  6. #2926
    Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    37

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by SuperDre View Post
    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.

  7. #2927
    Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    37

    Lightbulb Re: CommonControls (Replacement of the MS common controls)

    If it is possible, It would be great to add a LimitToList property to the ComboBoxW control like in Microsoft Access.

    https://docs.microsoft.com/en-us/off...ox.limittolist

  8. #2928
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,482

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Nouyana View Post
    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"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  9. #2929
    Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    37

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by LaVolpe View Post
    Depends on the combobox style. Only one of the styles supports IntegralHeight=False.
    Are you talking about SimpleCombo style? Without any list at all?


    Quote Originally Posted by LaVolpe View Post
    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.

  10. #2930
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,482

    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"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  11. #2931
    Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    37

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by LaVolpe View Post
    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".

    Quote Originally Posted by LaVolpe View Post
    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.

  12. #2932
    Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    37

    Re: CommonControls (Replacement of the MS common controls)

    I edited my previous post. We just posted them at the same time.

  13. #2933
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,482

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Nouyana View Post
    Selecting something in the list manualy is not realy the AutoSelect. User can leave the control without any clicking.
    That's why you have a LostFocus and Validate event. Use it.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  14. #2934
    Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    37

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by LaVolpe View Post
    That's why you have a LostFocus and Validate event. Use it.
    I just suggested. This property is almost always used in Access.

  15. #2935
    Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    37

    Re: CommonControls (Replacement of the MS common controls)

    Krool, why the AutoSelect property of ComboBox doesn't work when the control isn't dropped down? Was it intended?

  16. #2936
    Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    37

    Lightbulb Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by LaVolpe View Post
    That's why you have a LostFocus and Validate event. Use it.
    Maybe you are right. We have a FindItem property in the ComboBoxW control. Thus, the Validate subroutine may look very short:

    VB Code:
    1. Private Sub ComboBoxW1_Validate(Cancel As Boolean)
    2.    With ComboBoxW1
    3.       If .FindItem(.Text) = -1 Then Cancel = True
    4.    End With
    5. End Sub

  17. #2937
    Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    37

    Question 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.
    Attached Images Attached Images  

  18. #2938

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,617

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Nouyana View Post
    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.

  19. #2939
    Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    37

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    The PictureAndCaption property is meaningful only when the style property is 0 - Normal.
    Thank you. When can this be useful? Why not just use style 2?

  20. #2940
    Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    37

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Nouyana View Post
    Thank you. When can this be useful? Why not just use style 2?
    I meant style 1, of course.

  21. #2941
    Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    37

    Exclamation Re: CommonControls (Replacement of the MS common controls)

    Error with TextBoxW.OverTypeMode property

    Name:  OverTypeMode.gif
Views: 112
Size:  8.5 KB

  22. #2942

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,617

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Nouyana View Post
    Error with TextBoxW.OverTypeMode property

    Name:  OverTypeMode.gif
Views: 112
Size:  8.5 KB
    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

    Quote Originally Posted by Nouyana View Post
    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.

    Quote Originally Posted by Nouyana View Post
    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.
    Last edited by Krool; Sep 20th, 2020 at 12:30 PM.

  23. #2943
    Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    37

    Arrow Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    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

    Name:  AutoSelect.jpg
Views: 102
Size:  60.8 KB

    Quote Originally Posted by Krool View Post
    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

    OverTypeMode.zip
    Last edited by Nouyana; Sep 20th, 2020 at 11:17 PM.

  24. #2944

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,617

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Nouyana View Post
    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.

    Quote Originally Posted by Nouyana View Post
    Here it is. Tested under WinXP SP3 with comctl32.dll version 5.82.2900.6028
    CCRP v1.7.0.0

    OverTypeMode.zip
    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 = ""
    Last edited by Krool; Sep 21st, 2020 at 10:31 AM.

  25. #2945
    Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    37

    Arrow Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    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.

  26. #2946

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,617

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Nouyana View Post
    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.

  27. #2947

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,617

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    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.

Page 74 of 74 FirstFirst ... 246471727374

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width