Page 101 of 105 FirstFirst ... 51919899100101102103104 ... LastLast
Results 4,001 to 4,040 of 4199

Thread: CommonControls (Replacement of the MS common controls)

  1. #4001
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    Re: CommonControls (Replacement of the MS common controls)

    @Krool ,how to add this code to your project?

    insert link url or edit hyper link:
    Code:
     Const sFriendlyURL As String = "{\rtf1{\field{\*\fldinst{HYPERLINK ""URL""}}{\fldrslt{NAME}}}}" 'by fafalone 
    Function GetRtfCode(Optional ByVal FromSelectArea As Boolean) As String
        'add Function By XiaoYao
        Dim Buffer As String
        Buffer = vbNullString
        StreamStringOut Buffer, SF_RTF Or IIf(FromSelectArea, SFF_SELECTION, 0)
        GetRtfCode = StrToVar(Buffer) 'TextRTF
    End Function
    Private Sub RichTextBox1_LinkEvent(ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long _
    , ByVal LinkStart As Long, ByVal LinkEnd As Long)
    args from:LinkStart ,LinkEnd

    Code:
    Public Sub SetRange(ByVal SStart As Long, ByVal SLen As Long)
     '??????????????
     Dim CR As CHARRANGE
     CR.cpMin = SStart
     CR.cpMax = SStart + SLen
     SendMessage RichTextBoxHandle, EM_EXSETSEL, 0&, CR
    End Sub
    Sub EditLinkObj(ByVal txt As String, ByVal LinkUrl As String, ByVal LinkStartA As Long, ByVal LinkEndA As Long, Optional ByVal AddSTR As String = "  ")
    'add Function By XiaoYao
            SetRange LinkStartA, LinkEndA - LinkStartA
            If AddSTR <> "" Then txt = AddSTR & txt & AddSTR
            AddLink txt, LinkUrl
        End If
    End Sub
    Sub AddLink(txt As String, Url As String)
    'add Function By XiaoYao
        SelText = GetlinkRTF(txt, Url)
    End Sub
    Function GetlinkRTF(txt As String, sUrl As String) As String
        If Len(sUrl) Then
            GetlinkRTF = Replace(Replace(sFriendlyURL, "URL", sUrl), "NAME", txt) ' Create a hyperlink for the current selection using RTF syntax
        End If
    End Function

  2. #4002

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    You can get the link url as following:

    Code:
    Private Sub RichTextBox1_LinkEvent(ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long, ByVal LinkStart As Long, ByVal LinkEnd As Long)
    Const WM_LBUTTONDOWN As Long = &H201
    If wMsg = WM_LBUTTONDOWN Then
        Debug.Print RichTextBox1.GetTextRange(LinkStart, LinkEnd)
    End If
    End Sub
    Last edited by Krool; Apr 19th, 2025 at 03:04 AM.

  3. #4003
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    You can get the link url as following:

    Code:
    Private Sub RichTextBox1_LinkEvent(ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long, ByVal LinkStart As Long, ByVal LinkEnd As Long)
    Const WM_LBUTTONDOWN As Long = &H201
    If wMsg = WM_LBUTTONDOWN Then
        Debug.Print RichTextBox1.GetTextRange(LinkStart, LinkEnd)
    End If
    End Sub
    WHY GetTextRange IS GET URL?
    a=RichTextBox1.seltext it's for get text
    a=RichTextBox1.GetTextRange(LinkStart, LinkEnd)
    it's for get url

  4. #4004
    New Member
    Join Date
    Feb 2022
    Posts
    7

    Re: CommonControls (Replacement of the MS common controls)

    Hi Krool, thanks again for these controls. I want to replace my old button control with yours, but I'm running into a few issues. Please see attached image.

    Name:  2025-05-01 11_20_35-CompatWindow.png
Views: 2618
Size:  7.8 KB

    In the top example, the VBCCR18 button control does ok, but I much prefer the positioning of the icon and caption on the old control (i.e. less padding to the left of the icon, and padding between the icon and caption).
    The middle example has WordWrap = True, with no icon. Again, ok, but a bit more padding left/right would make it wrap better.
    The bottom example has both WordWrap = True and an icon. Here, the wordwrap doesn't account for the picture, and ends up pushing the icon off on the left and overflowing the caption on the right.

    Please let me know if you believe this (at least the bottom example) is a bug and can be fixed. Thanks! -Dan
    Last edited by hausman; May 1st, 2025 at 11:24 AM.

  5. #4005
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    Re: CommonControls (Replacement of the MS common controls)

    Your project is so huge, how do you manage tens of thousands of lines of code?

    This requires a very strong logical thinking, when I found a module if there are thousands of lines of code, I have been crazy.

  6. #4006

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by hausman View Post
    Hi Krool, thanks again for these controls. I want to replace my old button control with yours, but I'm running into a few issues. Please see attached image.

    Name:  2025-05-01 11_20_35-CompatWindow.png
Views: 2618
Size:  7.8 KB

    In the top example, the VBCCR18 button control does ok, but I much prefer the positioning of the icon and caption on the old control (i.e. less padding to the left of the icon, and padding between the icon and caption).
    The middle example has WordWrap = True, with no icon. Again, ok, but a bit more padding left/right would make it wrap better.
    The bottom example has both WordWrap = True and an icon. Here, the wordwrap doesn't account for the picture, and ends up pushing the icon off on the left and overflowing the caption on the right.

    Please let me know if you believe this (at least the bottom example) is a bug and can be fixed. Thanks! -Dan
    the VBCCR button has several "modes". one is the graphical style button which replicates the VB6 native style button. (Style property = Graphical)

    Alternativaly, use Style = Normal and set the "PictureAndCaption" property to True. This will be displayed then in a different way.

    Third way is to use an ImageList. Then you can refine the location with the ImageListAlignment and ImageListMargin property.

  7. #4007
    Addicted Member
    Join Date
    Oct 2014
    Posts
    128

    Re: CommonControls (Replacement of the MS common controls)

    Hello Krool!
    The control property of "TextBoxW" is set to "AllowOnlyNumbers=True", and only integers can be entered.
    You cannot enter decimals, or negative numbers.

    Can the control property of "TextBoxW" be set to "AllowOnlyNumbers=True" to allow the entry of decimal or negative numbers, such as: "0.015" or "-100"

    Thank you very much!

  8. #4008
    Hyperactive Member
    Join Date
    Jan 2012
    Location
    Recently moved from Europe to Panama
    Posts
    292

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by smileyoufu View Post
    Hello Krool!
    The control property of "TextBoxW" is set to "AllowOnlyNumbers=True", and only integers can be entered.
    You cannot enter decimals, or negative numbers.

    Can the control property of "TextBoxW" be set to "AllowOnlyNumbers=True" to allow the entry of decimal or negative numbers, such as: "0.015" or "-100"

    Thank you very much!

    In case this is not possible, there is an easy way to deal with this. Create a function that filters out all non-allowed keystrokes:

    Code:
    Function LimitTextInputToNumeric(KeyCode) As Interger
        Const Numbers$ = "0123456789.,-"
        'backspace = 8
        If KeyCode<> 8 Then
            If InStr(Numbers, Chr(KeyCode)) = 0 Then
                LimitTextInputToNumeric = 0
                Exit Function
            End If
        End If
        LimitTextInputToNumeric = KeyCode
    End Function
    Then from the KeyPress event call the function with the key code:

    Code:
    Private Sub txtMyTextBox_KeyPress(KeyAscii As Integer)
        KeyAscii = LimitTextInputToNumeric(KeyAscii)
    End Sub

    I als use functions for LimitToNumericNoNegative, LimitTextInputToZeroToNine, LimitTextInputToNumericNoDecimals so that I can fully control the input of each textbox where needed.

  9. #4009

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    Update released.

    Regression in the WM_PRINTCLIENT handler on the FrameW control due to changes done on 30-Mar-2025.

    Now themed only native Command/Option/CheckBox are automatically "transparent" again on a FrameW control.

  10. #4010
    Addicted Member
    Join Date
    Oct 2014
    Posts
    128

    Re: CommonControls (Replacement of the MS common controls)

    Hello Erwin69!
    Thank you so much for your kind help.
    The code you provided basically solved my problem.
    However, if the user enters the wrong number (such as "0.0-5" or "0.05-"), it will still not be filtered.

    On top of the code you provided, I've added a post-input, post-input digital compliance check verification. Solved this issue for me now.
    Maybe you'll have a better approach and idea.
    Thank you very much!
    Code:
    Private Sub txtMyTextBox_LostFocus()
        If VBA.IsNumeric(Me.txtMyTextBox.Text) = False Then
            Me.txtMyTextBox.SetFocus
            MsgBox "Only numbers are allowed"
        End If
    End Sub

  11. #4011
    Fanatic Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    540

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by smileyoufu View Post
    However, if the user enters the wrong number (such as "0.0-5" or "0.05-"), it will still not be filtered.
    Code:
    Private Sub txtMyTextBox_LostFocus()
       if instr(1,Me.txtMyTextBox.Text,"-") > 1 then
          MsgBox "wrong number"
        end if
    End Sub

  12. #4012
    Hyperactive Member
    Join Date
    Jan 2012
    Location
    Recently moved from Europe to Panama
    Posts
    292

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by smileyoufu View Post
    Hello Erwin69!
    Thank you so much for your kind help.
    The code you provided basically solved my problem.
    However, if the user enters the wrong number (such as "0.0-5" or "0.05-"), it will still not be filtered.

    On top of the code you provided, I've added a post-input, post-input digital compliance check verification. Solved this issue for me now.
    Maybe you'll have a better approach and idea.
    Thank you very much!
    Code:
    Private Sub txtMyTextBox_LostFocus()
        If VBA.IsNumeric(Me.txtMyTextBox.Text) = False Then
            Me.txtMyTextBox.SetFocus
            MsgBox "Only numbers are allowed"
        End If
    End Sub
    Well, I read the question as how to limit the input to 0-9 and other characters that can be used in doubles, like dot, comma and minus sign, not as making sure the user inputs a valid value. However, validating if the resulting input is a valid number can indeed be done in the LostFocus event.

    While you could do it Mith suggested, I'd use a generic "IsNumeric" function like you did. That way your validation is handled in a way that all sorts of situations are covered, plus it takes into consideration Windows regional settings.

    A self written function for the validation should also include if multiple decimal separators are being used. (E.g 78..6 or 1.2.3) Plus if your app is used in international environments you'd have to deal with all sorts of formatting that may be valid in one environment but not in the other. E.g. in most if not all countries in Europe the comma is used as a decimal separator, and the dot for digit groeping, so a number like 12.456,78 would be perfectly valid. Also in a negative number is displayed directly with a minus sign in front of the numbers, in front but separated by a space, directly at the end or at the end separated by a space. Have a look at the Windows regional setting for formatting numbers to get a feel for all variations.

  13. #4013
    New Member
    Join Date
    Feb 2022
    Posts
    7

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    the VBCCR button has several "modes". one is the graphical style button which replicates the VB6 native style button. (Style property = Graphical)

    Alternativaly, use Style = Normal and set the "PictureAndCaption" property to True. This will be displayed then in a different way.

    Third way is to use an ImageList. Then you can refine the location with the ImageListAlignment and ImageListMargin property.
    FYI, my original button is a different 3rd party button. I want to search / replace it with yours, but I can't without some tweaks.

    Style Graphical vs Normal appears to just set the orientation of the picture to the caption, either horizontal or vertical. The bottom example is already Style = Normal (horizontal, as intended). It just doesn't calculate the positioning correctly and pushes the pic off to the left in this case. (If I stretch the button out, it starts to appear).

    Finally, ImageList does lay out the pic & caption better, but precludes me from being able to search / replace the existing controls.

  14. #4014
    Lively Member
    Join Date
    Mar 2020
    Posts
    83

    Re: CommonControls (Replacement of the MS common controls)

    Hi,
    Today I came across this
    Code:
        ListView1.View = LvwViewReport
        
        ListView1.ColumnHeaders.Add
        ListView1.ColumnHeaders(1).Text = "Column 1"
        
        ListView1.ColumnHeaders.Add , , "Column 2"
    Only Column 2 shows, column 1 stays blank. Is it a bug or is it known as normal?

  15. #4015

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Crapahute View Post
    Hi,
    Today I came across this
    Code:
        ListView1.View = LvwViewReport
        
        ListView1.ColumnHeaders.Add
        ListView1.ColumnHeaders(1).Text = "Column 1"
        
        ListView1.ColumnHeaders.Add , , "Column 2"
    Only Column 2 shows, column 1 stays blank. Is it a bug or is it known as normal?
    Thanks. That's again a strange one.
    When inserting a column with a NULL pointer the column is screwed in some way.
    The text in the next line is successfully stored but not displayed.
    The fix would be to check if the StrPtr = 0 and then replace with a blank "". That way the column is not screwed and you later on can set to empty or a new text.

    Fix will follow soon.

    EDIT: Update released. Thanks again
    Last edited by Krool; May 6th, 2025 at 12:35 PM.

  16. #4016
    Addicted Member
    Join Date
    Oct 2014
    Posts
    128

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Erwin69 View Post
    Well, I read the question as how to limit the input to 0-9 and other characters that can be used in doubles, like dot, comma and minus sign, not as making sure the user inputs a valid value. However, validating if the resulting input is a valid number can indeed be done in the LostFocus event.

    While you could do it Mith suggested, I'd use a generic "IsNumeric" function like you did. That way your validation is handled in a way that all sorts of situations are covered, plus it takes into consideration Windows regional settings.

    A self written function for the validation should also include if multiple decimal separators are being used. (E.g 78..6 or 1.2.3) Plus if your app is used in international environments you'd have to deal with all sorts of formatting that may be valid in one environment but not in the other. E.g. in most if not all countries in Europe the comma is used as a decimal separator, and the dot for digit groeping, so a number like 12.456,78 would be perfectly valid. Also in a negative number is displayed directly with a minus sign in front of the numbers, in front but separated by a space, directly at the end or at the end separated by a space. Have a look at the Windows regional setting for formatting numbers to get a feel for all variations.
    Hello Erwin69!
    Thank you so much for helping me. Your guidance is very useful, and I will choose the right one reasonably.
    Thanks again!

  17. #4017
    New Member
    Join Date
    May 2021
    Posts
    7

    Re: CommonControls (Replacement of the MS common controls)

    Hello.
    For my MIDI audio device control project, I made a couple of small changes to the Slider control.
    1. I added the new "ThumbSize" property to be able to resize the default Thumb so that it can be used more easily with the touch screen.
    2. Using the existing "Reversed" property, I implemented the ability to reverse the direction of the slider value (both vertically and horizontally).
    I marked my changes with the comment: 'VariazioneBG ====.
    I hope I haven't made any serious mistakes. In my project it works perfectly.
    I thought that perhaps these changes could be of interest to others as well.

    Secondly, I ask if it wasn't possible and useful to add a property to the slider (e.g. TumbPicture) to be able to choose your own image to use instead of the default Thumb. I know that it is possible through the DrawMode property. But I'm not expert enough to do it myself.
    In my opinion, it is a good addition that can enrich the value of the Slider control.
    Thank you for your attention and valuable work.
    Attached Files Attached Files
    Last edited by sagit62; May 16th, 2025 at 03:39 AM.

  18. #4018

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    Update released.

    DroppedDown property improved in the CommandButtonW control to raise the DropDown event when set to True.

    Basically prior to this update the DroppedDown property was kind of useless because it just used BCM_SETDROPDOWNSTATE which does not raise BCN_DROPDOWN.

    Now it raises the event properly and ensure the button is redrawn before and after the event. Also it checks for BST_DROPDOWNPUSHED to not allow recursive entry.
    The property makes nothing when BS_SPLITBUTTON is not defined.

  19. #4019
    Fanatic Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    540

    CommandButtonW DroppedDown bug

    Quote Originally Posted by Krool View Post
    Update released.

    DroppedDown property improved in the CommandButtonW control to raise the DropDown event when set to True.

    Basically prior to this update the DroppedDown property was kind of useless because it just used BCM_SETDROPDOWNSTATE which does not raise BCN_DROPDOWN.

    Now it raises the event properly and ensure the button is redrawn before and after the event. Also it checks for BST_DROPDOWNPUSHED to not allow recursive entry.
    The property makes nothing when BS_SPLITBUTTON is not defined.
    There is still a bug when using the DropDown property:

    Clicking fast on the DropDown arrow triggers the DropDown event AND the Click Event. A click with "normal speed" triggers only the DropDown event.
    That is really annyoing if for example the Click Event opens a message box and the user only clicks on the DropDown arrow...

    Can this be fixed? for example: IF DropDown arrow click THEN dont raise the Click Event

  20. #4020

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommandButtonW DroppedDown bug

    Update released.

    Removed BS_NOTIFY on CommandButtonW/OptionButtonW/CheckBoxW/CommandLink. (like native VB controls)
    BN_DOUBLECLICKED therefore is not generated anymore, except for BS_RADIOBUTTON (OptionButtonW) even though BS_NOTIFY is not set.
    But OptionButtonW has a DblClick event and therefore is wanted. (like native OptionButton)
    A double click will then raise a Click event upon mouse up instead of immediately. (like native VB controls)
    This resolves also a side-effect bug in the CommandButtonW control which raised a Click event when doing a double click on the split button part. (BN_DOUBLECLICKED)

    Quote Originally Posted by Mith View Post
    There is still a bug when using the DropDown property:

    Clicking fast on the DropDown arrow triggers the DropDown event AND the Click Event. A click with "normal speed" triggers only the DropDown event.
    That is really annyoing if for example the Click Event opens a message box and the user only clicks on the DropDown arrow...

    Can this be fixed? for example: IF DropDown arrow click THEN dont raise the Click Event
    It's a bug in the button control that a WM_LBUTTONDBLCLK on the split button part translates to a BN_DOUBLECLICKED notification.
    As described above I didn't try to workaround this bug but rather circumvent it, by removing BS_NOTIFY which is also the correct way to do to match native VB controls.
    I think it was kind of a relict from the early stages where I thought "can't harm to have more notifications" but did not grasp the side-effects.

    Thanks for pointing this out to eliminate a deep bug!

  21. #4021
    Fanatic Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    540

    Re: CommandButtonW DroppedDown bug

    Quote Originally Posted by Krool View Post
    Update released.
    ...
    It's a bug in the button control that a WM_LBUTTONDBLCLK on the split button part translates to a BN_DOUBLECLICKED notification.
    As described above I didn't try to workaround this bug but rather circumvent it, by removing BS_NOTIFY which is also the correct way to do to match native VB controls.
    I think it was kind of a relict from the early stages where I thought "can't harm to have more notifications" but did not grasp the side-effects.
    The problem is solved with v1.8.69! thanks

  22. #4022
    Fanatic Member gaouser's Avatar
    Join Date
    Mar 2022
    Location
    Turkey, down the old sides of Fatih
    Posts
    607

    Re: CommonControls (Replacement of the MS common controls)

    This is AWESOME. Time to get rid of the COMCTL32.OCX dependency!

    got nuthin' to do but to make a new project, hype, then give up

    Check out all my cool stuff btw
    VB: EveryDiscord, a Discord client made fully in VB6 | MSPaint Modifier, a VB6-based MSPaint hooking engine, experimental | OpenIM, a fully VB6 instant messaging service based on TCP/IP connections | Kadooki (Overall the AltWWW project), the WWW re-imagined by me with continuations of HTML3.2's parts. | ClaFeed, A little feed algorithm I have been developing for a Twitter-style system. | CfmOS PC, my project CfmOS ported to VB6 in order to prototype faster, often lags on updates though!

    C: LegacyResource, a little ResHacker ripoff | CfmOS, A mobile OS designed to mimic AOSP (Stock Android) on an ESP32-S3, featuring a full bytecode architecture

  23. #4023
    Fanatic Member gaouser's Avatar
    Join Date
    Mar 2022
    Location
    Turkey, down the old sides of Fatih
    Posts
    607

    Re: CommonControls (Replacement of the MS common controls)

    Manifests didn't work in XP, CommonControl manifests are stricter there, Fixing manifest solves the issue, ResourceHacker template works.

    got nuthin' to do but to make a new project, hype, then give up

    Check out all my cool stuff btw
    VB: EveryDiscord, a Discord client made fully in VB6 | MSPaint Modifier, a VB6-based MSPaint hooking engine, experimental | OpenIM, a fully VB6 instant messaging service based on TCP/IP connections | Kadooki (Overall the AltWWW project), the WWW re-imagined by me with continuations of HTML3.2's parts. | ClaFeed, A little feed algorithm I have been developing for a Twitter-style system. | CfmOS PC, my project CfmOS ported to VB6 in order to prototype faster, often lags on updates though!

    C: LegacyResource, a little ResHacker ripoff | CfmOS, A mobile OS designed to mimic AOSP (Stock Android) on an ESP32-S3, featuring a full bytecode architecture

  24. #4024
    Addicted Member
    Join Date
    Oct 2014
    Posts
    128

    Re: CommonControls (Replacement of the MS common controls)

    Hello Krool!
    Thank you so much for your great dedication. I've been using your controls for years.

    Bug Reports:
    An error occurs if the value of ImageCombo1.FindItem(100) is greater than 99 (3 digits or more in length). Normal within 2 digits.


    Name:  Err.jpg
Views: 4137
Size:  42.8 KB

    Code:
    Private Sub Form_Load()
        Dim i As Long
        For i = 99 To 110
            ImageCombo1.ComboItems.Add , CStr(i), CStr(i)
        Next
    
        'OK
        Debug.Print ImageCombo1.FindItem(99).Text
        Debug.Print ImageCombo1.FindItem(99).Key
    
    
        'Error
        Debug.Print ImageCombo1.FindItem(100).Text
        Debug.Print ImageCombo1.FindItem(100).Key
    
        ImageCombo1.ComboItems.Clear
    
        'OK
        ImageCombo1.ComboItems.Add , "AB", "AB"
        Debug.Print ImageCombo1.FindItem("AB").Text
    
        ''Error
        ImageCombo1.ComboItems.Add , "ABC", "ABC"
        Debug.Print ImageCombo1.FindItem("ABC").Key
    
    End Sub
    
    Private Sub ImageCombo1_Click()
      MsgBox ImageCombo1.Text
    End Sub
    Last edited by smileyoufu; Jun 2nd, 2025 at 09:35 AM.

  25. #4025

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    smileyoufu,

    Thanks for reporting this. Update released.

    It looks like some CB_ message are now suddenly not working properly anymore when sending directly to the inner combo handle. For example CB_GETLBTEXT stops after the 2nd char while CB_GETLBTEXTLEN returns the correct length.
    I checked those messages and are now sent to the superclass window (ComboBoxEx) which handles the result correctly. They also work then on comctl version 5.8x and 6.0 [XP] even though the bug appears to happen only as of comctl version 6.1 [Vista+].

  26. #4026
    Addicted Member
    Join Date
    Oct 2014
    Posts
    128

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    smileyoufu,

    Thanks for reporting this. Update released.

    It looks like some CB_ message are now suddenly not working properly anymore when sending directly to the inner combo handle. For example CB_GETLBTEXT stops after the 2nd char while CB_GETLBTEXTLEN returns the correct length.
    I checked those messages and are now sent to the superclass window (ComboBoxEx) which handles the result correctly. They also work then on comctl version 5.8x and 6.0 [XP] even though the bug appears to happen only as of comctl version 6.1 [Vista+].
    Hello Krool!
    Thank you so much for the quick fix.

    Version: "1.8.74", issue resolved successfully

  27. #4027

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    Update released.

    MultiSelect property does not enforce anymore possible selection change in the ListView control. (like MS ListView)

    This means that when having 5 items selected and turning off the MultiSelect property then those 5 items stay selected instead of immediately reducing it to 1 item.

  28. #4028
    Lively Member
    Join Date
    Sep 2022
    Location
    Uruguay
    Posts
    70

    Re: CommonControls (Replacement of the MS common controls)

    Hi, Krool!
    Does your Font Common Dialog provide a way to change the sample text? The default "AaBbYyZz" is Ok but if a way to change it is already implemented it would be nice to have it exposed. If it's not implemented then never mind, it isn't important.

  29. #4029

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by jpfa View Post
    Hi, Krool!
    Does your Font Common Dialog provide a way to change the sample text? The default "AaBbYyZz" is Ok but if a way to change it is already implemented it would be nice to have it exposed. If it's not implemented then never mind, it isn't important.
    No, not possible.

  30. #4030
    Member
    Join Date
    Feb 2023
    Posts
    55

    Re: CommonControls (Replacement of the MS common controls)

    Hi Krol,

    I have the follwoing problem when loading VBCCR controls at runtime

    1. Show a standard Form
    3. Then add a VBBCR17 control at runtime,
    either an control array:
    Code:
           Load Labels(i)
           Labels(i).Visible = True
    or with
    Code:
           Dim NewLabel as LabelW      
           ...
           Set NewLabel = Me.controls.Add("LabelW", "NewLabel", Me
           MyLabel.Visible = True
    In the IDE this works fine, but on runtime error 13 (type mismatch) occurs.
    This is related to my manifest. Without that manifest / res file it works fine

    Any idea what might cause this?


    Example project:
    ControlNotShownAtRuntime.zip



    (
    When I change the definition of NewLabel to
    Code:
    Dim NewLabel As Control
    it works as well.
    but e.g.
    Code:
    Dim WithEvents NewTextBox As Control
    causes an compile error
    )
    Last edited by Chris_G33; Jun 27th, 2025 at 05:49 PM.

  31. #4031
    Addicted Member
    Join Date
    Oct 2014
    Posts
    128

    Re: CommonControls (Replacement of the MS common controls)

    Hello Krool!
    Thank you so much for helping me!
    ListBoxW,Error reports:
    In the IDE properties, if you manually set ListBoxW2.Height = 290, the Height result will change to 280.
    Set ListBoxW2.Height = 260, and the Height result will change to 256.

    The same problem exists with the way you use the drag and drop control.
    Thanks again.

    Name:  ????_20250709074811.png
Views: 3195
Size:  10.1 KB

    Name:  ????_20250709074918.png
Views: 3178
Size:  13.0 KB

    Name:  ????_20250709080357.png
Views: 3192
Size:  13.8 KB

    Name:  ????_20250709080402.png
Views: 3114
Size:  13.1 KB

  32. #4032
    Fanatic Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    540

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by smileyoufu View Post
    Hello Krool!
    Thank you so much for helping me!
    ListBoxW,Error reports:
    In the IDE properties, if you manually set ListBoxW2.Height = 290, the Height result will change to 280.
    Set ListBoxW2.Height = 260, and the Height result will change to 256.
    IntegralHeight property

    When this property is set to true, the control automatically resizes to ensure that an item is not partially displayed.

    Set it to FALSE to fix your problem.

  33. #4033
    Addicted Member
    Join Date
    Oct 2014
    Posts
    128

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Mith View Post
    IntegralHeight property

    When this property is set to true, the control automatically resizes to ensure that an item is not partially displayed.

    Set it to FALSE to fix your problem.
    Hello Mith!
    Thanks for the help. The solution you provided solved my problem.
    Thank you very much!

  34. #4034
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    3,560

    Re: CommonControls (Replacement of the MS common controls)

    Question for Krool or any other users of Krool's checkbox/option box replacements. I am fairly sure I know the answer already but it is worth asking.

    re: this request on the TwinBasic issues list: https://github.com/twinbasic/twinbasic/issues/2174

    I am looking for a checkbox control that can be resized, not just the width/height of the overall control including the caption field but the check box itself.
    When rescaling a form for large monitor sizes, the current VB6 checkboxes and optionboxes remain the same size tiny efforts, looking rather puny on an up-scaled form.

    There seem to be very few 3rd party alternatives to the standard VB6/Windows checkbox so I am digging for a replacement that can do the job I require. Krool's checkbox seems to be a good place to start.

    So, can the checkbox graphic be made to scale in size in ratio to the form itself?

    This image shows the problem, see the tiny option and check boxes?



    If you could take this as the first stage of a feature request to allow additional such resizing of the checkbox and option buttons, the only VB6 controls that do not rescale correctly in my experience.

    FYI TwinBasic offers a scalable checkbox without a caption. We are almost there.
    Your thoughts.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  35. #4035

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    Is your app marked as DpiAware ? Normally the checkbox size is fixed (13×13) but will scale to your dpi factor.
    So I am wondering why it doesn't in your app.

  36. #4036
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    3,560

    Re: CommonControls (Replacement of the MS common controls)

    Yes, DPI aware. Desktop scaling is disabled. All forms appear at a normal 100%.

    The scaling performed above is being performed in code to allow a form to be scaled dynamically by dragging the corner up or down to resize. All controls are anchored and during a resize event are sized by proportion to the scaling of the whole form.

    This means you can scale a form independently of the desktop and have a form at any chosen size you require.

    The following image shows very similar forms scaled to size manually using the above method.



    The only control that does not size 'correctly' are the check and option buttons.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  37. #4037
    Fanatic Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    540

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by yereverluvinuncleber View Post
    The scaling performed above is being performed in code to allow a form to be scaled dynamically by dragging the corner up or down to resize.
    You have to set the DrawMode property of the control to "...OwnerDraw" and draw the control by yourself to choose the size of e.g. the option button.

  38. #4038
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    3,560

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Mith View Post
    You have to set the DrawMode property of the control to "...OwnerDraw" and draw the control by yourself to choose the size of e.g. the option button.
    Yes, that is what I understand, not having done that before it is still a minor mystery to me.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  39. #4039
    Fanatic Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    540

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by yereverluvinuncleber View Post
    Yes, that is what I understand, not having done that before it is still a minor mystery to me.
    First set the DrawMode property to OwnerDraw. Now you can draw your own control in the OwnerDraw event of the control:

    Code:
    Private Sub CheckBox_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)
    End Sub
    With the provided hDC and the control sizes you can use APIs to draw anything inside the the control.

  40. #4040
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    3,560

    Re: CommonControls (Replacement of the MS common controls)

    Yup, I've been doing some research myself. I'm not going to proceed down this path as it is a workaround at best. What I am looking for is for the two controls, the option buttons and checkboxes to scale by default. Reason I am saying this is that it would be, in my opinion, a very useful default property to allow VB6 forms to be scaled dynamically without Windows desktop scaling being enabled.

    The images above show all the controls successfully scaled except for these two failing controls.

    We are now in the time of large 4K+ monitors that make VB6 apps look puny in size. A simple rescale of the form means that VB6 apps can now suit any size monitor without affecting desktop default scaling settings, that can have an adverse effect on other apps.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

Page 101 of 105 FirstFirst ... 51919899100101102103104 ... LastLast

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