Page 63 of 94 FirstFirst ... 13536061626364656673 ... LastLast
Results 2,481 to 2,520 of 3726

Thread: CommonControls (Replacement of the MS common controls)

  1. #2481
    Addicted Member
    Join Date
    Jul 2017
    Posts
    233

    Re: CommonControls (Replacement of the MS common controls)

    Excuse me , but I couldn`t find a description for the method in comments in activex version or even in mountainman`s documentation . Where can I find it ?

    And for commandbuttonw , my bad . I have forgotten to set it at first .

    Edit :
    I found it in object browser . Thanks krool .
    Last edited by Hosam AL Dein; Jan 12th, 2020 at 01:02 PM.

  2. #2482

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,375

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by OldClock View Post
    If so, it would be good to rename that function to InitVisualStyleFixes to make things more clear.
    I will make things more clear and followed your suggestion. Therefore VisualStyles.bas got updated.

    * InitVisualStyles -> InitVisualStylesFixes
    * SetupVisualStyles -> SetupVisualStylesFixes

    Info:
    I really thought about the renaming. Rather to rename as 'VisualStylesFixes' or as you suggested 'VisualStyleFixes'.
    However, looking at this as a single noun phrase rather than "two words in plural" brought me to the conclusion to 'VisualStylesFixes', because a 'fix' is a relationship between multiple components.
    Thus, the singular form is "visual styles fix". (There is never just 1 single visual style affected, thus this always refer to plural visual styles)
    And as there are different kind of fixes the plural is "visual styles fixes".
    Last edited by Krool; Jan 12th, 2020 at 02:37 PM.

  3. #2483
    Addicted Member
    Join Date
    Jul 2016
    Posts
    230

    Re: CommonControls (Replacement of the MS common controls)

    Krool, Great!

    Now a different topic - migration.

    In my effort to migrate my large project to use VBCCR, I got the idea of simply replacing every occurrence of standard MS widgets with VBCCR ones using sed (tested in Linux using sed-4.5).

    The script is:
    Code:
    sed -i -E \
        -e "s/(Begin[[:blank:]]+)MSComCtl2.DTPicker([[:blank:]]+)/\1VBCCR16.DTPicker\2/" \
        -e "s/(Begin[[:blank:]]+)MSComCtl2.MonthView([[:blank:]]+)/\1VBCCR16.MonthView\2/" \
        -e "/[[:blank:]]+StartOfWeek[[:blank:]]+=[[:blank:]]+[[:digit:]]+/d" \
        -e "s/(Begin[[:blank:]]+)MSComCtl2.UpDown([[:blank:]]+)/\1VBCCR16.UpDown\2/" \
        -e "s/(Begin[[:blank:]]+)MSComctlLib.ListView([[:blank:]]+)/\1VBCCR16.ListView\2/" \
        -e "s/(Begin[[:blank:]]+)MSComctlLib.ProgressBar([[:blank:]]+)/\1VBCCR16.ProgressBar\2/" \
        -e "s/(Begin[[:blank:]]+)MSComctlLib.Slider([[:blank:]]+)/\1VBCCR16.Slider\2/" \
        -e "s/(Begin[[:blank:]]+)MSComctlLib.TreeView([[:blank:]]+)/\1VBCCR16.TreeView\2/" \
        -e "s/(Begin[[:blank:]]+)RichTextLib.RichTextBox([[:blank:]]+)/\1VBCCR16.RichTextBox\2/" \
        -e "s/(Begin[[:blank:]]+)VB.CheckBox([[:blank:]]+)/\1VBCCR16.CheckBoxW\2/" \
        -e "s/(Begin[[:blank:]]+)VB.ComboBox([[:blank:]]+)/\1VBCCR16.ComboBoxW\2/" \
        -e "s/(Begin[[:blank:]]+)VB.CommandButton([[:blank:]]+)/\1VBCCR16.CommandButtonW\2/" \
        -e "s/(Begin[[:blank:]]+)VB.Frame([[:blank:]]+)/\1VBCCR16.FrameW\2/" \
        -e "s/(Begin[[:blank:]]+)VB.Label([[:blank:]]+)/\1VBCCR16.LabelW\2/" \
        -e "s/(Begin[[:blank:]]+)VB.ListBox([[:blank:]]+)/\1VBCCR16.ListBoxW\2/" \
        -e "s/(Begin[[:blank:]]+)VB.OptionButton([[:blank:]]+)/\1VBCCR16.OptionButtonW\2/" \
        -e "s/(Begin[[:blank:]]+)VB.TextBox([[:blank:]]+)/\1VBCCR16.TextBoxW\2/" \
        foo.frm
    Test-project:
    test_repo.zip

    This seems to work well in the test-project. To prove it:
    1. Open the mscc.vbp in the attached project, then open Form1 in the VB6 IDE.
    Name:  screenshot_20200113_183647.jpg
Views: 1737
Size:  18.5 KB
    2. Run the script on mscc.frm. All it does is to replace the MS widgets with the VBCCR ones, e.g.:
    Code:
    -   Begin VB.OptionButton Option1
    +   Begin VBCCR16.OptionButtonW Option1
    3. Open mscc.vbp in the VB6 IDE, open Form1. Still works well, and all the widgets are now VBCCR, great.
    Name:  screenshot_20200113_190019.jpg
Views: 1475
Size:  18.6 KB

    However, when I do the same to my real project, then when I open the project in the VB6 IDE and try to open the form I get this error:
    Run-time error '713':
    Class not registered.
    Name:  screenshot_20200113_190329.png
Views: 1431
Size:  4.7 KB

    When I try opening the form again, I now get this error:
    Run-time error '429':
    ActiveX component can't create object
    Name:  screenshot_20200113_190431.png
Views: 1460
Size:  5.3 KB

    Any idea what this means, or where to look, or how to get VB6 to tell me which class is not registered?

  4. #2484

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,375

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by OldClock View Post
    Any idea what this means, or where to look, or how to get VB6 to tell me which class is not registered?
    There are quite some other "naming swaps" needed.
    Example: 'MSComctlLib.Node' -> 'VBCCR16.TvwNode'
    and so on..

  5. #2485
    Addicted Member
    Join Date
    Jul 2016
    Posts
    230

    Re: CommonControls (Replacement of the MS common controls)

    Those would cause problems at compile time, but not while just attempting to open a form, no?

  6. #2486

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,375

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by OldClock View Post
    Those would cause problems at compile time, but not while just attempting to open a form, no?
    Which compile time errors? Then you know the spot which is causing the error and you can fix it.

  7. #2487
    Addicted Member
    Join Date
    Jul 2016
    Posts
    230

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    Which compile time errors? Then you know the spot which is causing the error and you can fix it.
    Having MSComctlLib.Node in the code would cause errors at compile-time, but that is not the problem. The problem I'm experiencing is an error when trying to open a form in the IDE, and as far as I know the form has no MSComctlLib.Node (I searched through the form code).

  8. #2488

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,375

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by OldClock View Post
    Having MSComctlLib.Node in the code would cause errors at compile-time, but that is not the problem. The problem I'm experiencing is an error when trying to open a form in the IDE, and as far as I know the form has no MSComctlLib.Node (I searched through the form code).
    The .frx file is the problem in this case.
    You can only delete it and supply then the lost information again in the properties.

  9. #2489
    Addicted Member
    Join Date
    Jul 2016
    Posts
    230

    Re: CommonControls (Replacement of the MS common controls)

    Ah that's a pity - would have been so easy otherwise.

  10. #2490
    Addicted Member
    Join Date
    Jul 2016
    Posts
    230

    Re: CommonControls (Replacement of the MS common controls)

    I managed to pull it off, and documented the process in the "How I migrated my project to VBCCR" thread:
    http://www.vbforums.com/showthread.p...45#post5444945

  11. #2491

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,375

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by OldClock View Post
    I managed to pull it off, and documented the process in the "How I migrated my project to VBCCR" thread:
    http://www.vbforums.com/showthread.p...45#post5444945
    Good one.

    Update released. The migration problem for 'PasswordChar' got fixed. So you can update your script accordingly that the removal is not necessary anymore.

  12. #2492
    Addicted Member
    Join Date
    Jul 2016
    Posts
    230

    Re: CommonControls (Replacement of the MS common controls)

    Thanks, script updated - PasswordChar line removed.

  13. #2493
    New Member
    Join Date
    Jan 2020
    Posts
    5

    Re: CommonControls (Replacement of the MS common controls)

    Krool, thank you for these controls, they saved my app.
    I have a problem with the status bar control, the "Spring" autosize parameter seems to not work like the standard control.
    When all the panels of the bar have the "Spring" parameter and you resize the container window, in the standard controls they resize proportionally, but in your control all but the last panel remain of the design-time size, while the last one fills all the new space.
    What can I do to reproduce the standard control behavior?
    Attached a sample project.
    StatusBar.zip

  14. #2494
    Addicted Member
    Join Date
    Jul 2016
    Posts
    230

    Re: CommonControls (Replacement of the MS common controls)

    kr00l is centering text in textboxes broken in 1.6.58? I can't get it centered...
    Name:  screenshot_20200115_182624.jpg
Views: 1400
Size:  32.1 KB
    textbox_not_centering.zip

  15. #2495

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,375

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by sbri View Post
    I have a problem with the status bar control, the "Spring" autosize parameter seems to not work like the standard control.
    When all the panels of the bar have the "Spring" parameter and you resize the container window, in the standard controls they resize proportionally, but in your control all but the last panel remain of the design-time size, while the last one fills all the new space.
    What can I do to reproduce the standard control behavior?
    Fixed. Thanks!! (Update released)

    Quote Originally Posted by OldClock View Post
    kr00l is centering text in textboxes broken in 1.6.58? I can't get it centered...
    I can't reproduce. For me it's centering and no problem in your demo...

  16. #2496
    New Member
    Join Date
    Jan 2020
    Posts
    5

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    Fixed. Thanks!! (Update released)
    Thank you for the fix!

  17. #2497
    New Member
    Join Date
    Jan 2020
    Posts
    5

    Re: CommonControls (Replacement of the MS common controls)

    (duplicate please delete)

  18. #2498
    Addicted Member
    Join Date
    Jul 2016
    Posts
    230

    Re: CommonControls (Replacement of the MS common controls)

    Hi kr00l

    In relation to http://www.vbforums.com/showthread.p...=1#post5446145

    My MainForm.frm is very large. Editing it in the VB6 IDE was slow when using Microsoft Windows Common Controls(-2) 6.0, but now with VBCCR16 (currently on 1.06.0058 OCX) it has become unusably slow (>20 seconds to open the MainForm for editing in the IDE). I suspect my program is larger than most, so it's no surprise that these issues appear.

    Sometimes a crash occurs while opening the main form in the IDE or in the compiled program. The first time I run the compiled EXE after booting Windows (XP SP3 in VBox), the login screen shows correctly, and when I log it and the program tries to show the MainForm it crashes with a VBCCR window appearing with the error message
    Run-time error '0'
    The login screen should look like this:
    Name:  screenshot_20200120_184029.png
Views: 1198
Size:  16.3 KB

    When it crashes, it becomes like this, with those diagonal lines and horrible kerning:
    Name:  screenshot_20200120_183722.png
Views: 1222
Size:  123.1 KB

    The error signature:
    AppName: cannonfodder.exe AppVer: 3.0.0.5 ModName: msvbvm60.dll
    ModVer: 6.0.98.2 Offset: 00063f5a
    If I re-run the EXE and re-login, the MainForm shows correctly.

    These crashes do not result from the program's code, as it has been stable for a long time, and only appeared after switching to VBCCR. I suppose they come from a combination of factors: the main form containing a huge number of controls (2500 in total), perhaps more than VB6 was designed for; imperfections in VBCCR; and bugs in Windows.

    Sometimes the same sort of crash happens from within the IDE, with the diagonal lines and bad kerning, but there the error signature says:
    AppName: vb6.exe AppVer: 6.0.97.82 ModName: unknown
    ModVer: 0.0.0.0 Offset: 1110a460
    Is this a known issue, and is there anything I can do to mitigate it?

    Unfortunately I am not allowed to upload the code.

    I also ran into this error:
    Run-time error '7':
    Out of memory
    Name:  screenshot_20200120_182932.png
Views: 1148
Size:  3.5 KB

    It turns out this has nothing to do with memory, and appears only if the OCX file is not placed alongside my program's executable (I use side-by-side loading via the manifest file embedded in the resource file). It would be better if the error message actually said that the OCX file is missing.

    Kind regards

  19. #2499

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,375

    Re: CommonControls (Replacement of the MS common controls)

    OldClock,

    The run time error '0' we had already a few times in this thread.
    Its an incompatibility of 32 bit icons loaded at design time on in Vista+ (ok so far) but then later crashes when you attempt to use them in Win XP. (MS issue)

  20. #2500
    Member
    Join Date
    Apr 2019
    Posts
    51

    Re: CommonControls (Replacement of the MS common controls)

    Hi Krool,

    Thank you for your effort to keep this project alive and up-to-date, it's a huge commitment, also huge time-consumer. Appreciate it.

    Today I decided to replace some of components in my application with a ListView control. Since dark theme is widely used nowadays, my app also support it. However, when I added Groups to my listview, the result wasn't very beautiful as you can see below:

    Name:  lvGroupColorUntoched.JPG
Views: 1169
Size:  18.0 KB

    Initially, I tried to set fore color of the Group text as follows:

    Code:
    Friend Property Let FGroupForeColor(ByVal Value As OLE_COLOR)
    Dim groupMetrics As LVGROUPMETRICS
    
    groupMetrics.cbSize = Len(groupMetrics)
    groupMetrics.Mask = LVGMF_TEXTCOLOR
    groupMetrics.crHeader = Value
    
    If ListViewHandle <> 0 Then
        SendMessage ListViewHandle, LVM_SETGROUPMETRICS, 0, ByVal VarPtr(groupMetrics)
        Me.Refresh
    End If
    End Property
    Unfortunately, LVGMF_TEXTCOLOR is not implemented (really) and the result was...none.

    Most of the Google results state that changing color of group text is not possible (like this). However, I found that article in MSDN forum:

    https://social.msdn.microsoft.com/Fo...orum=vbgeneral

    and after some time, I had this:

    Name:  lvGroupColor.png
Views: 1201
Size:  8.4 KB

    After adding centered blank header title:
    Name:  Header.png
Views: 1143
Size:  3.9 KB

    The code is quite ugly but it works somehow, just to prove that it is completely possible to draw a custom Group header:

    Code:
           Case NM_CUSTOMDRAW
                            Dim FontHandle As Long, Bold As Boolean, ForeColor As OLE_COLOR
                            Dim NMLVCD     As NMLVCUSTOMDRAW
    
                            CopyMemory NMLVCD, ByVal lParam, LenB(NMLVCD)
    
                            Select Case NMLVCD.NMCD.dwDrawStage
                                Case CDDS_PREPAINT
                                    WindowProcUserControl = CDRF_NOTIFYITEMDRAW
    
                                    If NMLVCD.dwItemType = LVCDI_GROUP Then
                                        Dim rectHeader As RECT: rectHeader.Top = LVGGR_HEADER
                                        Dim nItem      As Long: nItem = NMLVCD.NMCD.dwItemSpec
                                        Dim nRet       As Long: nRet = SendMessage(ListViewHandle, LVM_GETGROUPRECT, nItem, rectHeader)
                                        
                                        Dim hPen       As Long: hPen = CreatePen(0, 1, vbRed)
                                        Dim OldhPen    As Long: OldhPen = SelectObject(NMLVCD.NMCD.hDC, hPen)
                                        Dim hBrush     As Long: hBrush = CreateSolidBrush(&H80FF&)
                                        Dim OldhBrush  As Long: OldhBrush = SelectObject(NMLVCD.NMCD.hDC, hBrush)
                                                                            
                                        Rectangle NMLVCD.NMCD.hDC, rectHeader.Left, rectHeader.Top, rectHeader.Right, rectHeader.Bottom
                                        Call SetTextColor(NMLVCD.NMCD.hDC, vbGreen)
                                        Call DrawText(NMLVCD.NMCD.hDC, "TEST1-2-3", Len("TEST1-2-3"), rectHeader, DT_SINGLELINE Or DT_CENTER Or DT_VCENTER)
                                        
                                        DeleteObject hPen: DeleteObject hBrush
                                    End If
    
                                    Exit Function

    I believe that many people will appreciate a custom Group Header. My knowledge is not enough to make it bullet-proof, I just copy-paste. For example, now adding a footer doesn't work - IDE crash.

    Dark theme really doesn't look good with blue group header

    Thank you.

    Edit: the code above doesn't break Group.Footer, in my case the Footer works only when SubsetLink is set, otherwise, the IDE crashes. It's the same with Standard EXE Version sample.

    Code:
            With .Groups.Add(, , "Header Title")
                '.SubsetLink = "Subset Link?"
                .Footer = "Footer Title"
                .FooterAlignment = LvwGroupFooterAlignmentCenter
            End With
    Attached Images Attached Images  
    Last edited by npac4o; Jan 21st, 2020 at 04:17 AM. Reason: Attaching pictures to the post

  21. #2501
    Member
    Join Date
    Apr 2019
    Posts
    51

    Re: CommonControls (Replacement of the MS common controls)

    Code:
    If NMLVCD.dwItemType = LVCDI_GROUP Then
        Dim rectHeader As RECT: rectHeader.Top = LVGGR_HEADER
        Dim nItem      As Long: nItem = NMLVCD.NMCD.dwItemSpec
        Dim nRet       As Long: nRet = SendMessage(ListViewHandle, LVM_GETGROUPRECT, nItem, rectHeader)
        
        Dim hPen       As Long: hPen = CreatePen(5, 1, vb3DFace)
        Dim OldhPen    As Long: OldhPen = SelectObject(NMLVCD.NMCD.hDC, hPen)
        Dim hBrush     As Long: hBrush = CreateSolidBrush(&H80FF&)
        Dim OldhBrush  As Long: OldhBrush = SelectObject(NMLVCD.NMCD.hDC, hBrush)
                                            
        Dim lvg As LVGROUP: With lvg
            .cbSize = Len(lvg)
            .Mask = LVGF_STATE Or LVGF_GROUPID Or LVGF_HEADER
        End With
    
        nRet = SendMessage(ListViewHandle, LVM_GETGROUPINFO, nItem, lvg)
        Dim sText As String: sText = GetStringFromPointer(lvg.pszHeader)
                                            
        Call Rectangle(NMLVCD.NMCD.hDC, rectHeader.Left, rectHeader.Top, rectHeader.Right, rectHeader.Bottom)
        Call SetTextColor(NMLVCD.NMCD.hDC, vbGreen)
        Call DrawText(NMLVCD.NMCD.hDC, sText, Len(sText), rectHeader, DT_SINGLELINE Or DT_CENTER Or DT_VCENTER Or DT_NOCLIP)
        
        DeleteObject hPen: DeleteObject hBrush
        WindowProcUserControl = CDRF_SKIPDEFAULT
    Else
        WindowProcUserControl = CDRF_NOTIFYITEMDRAW
    End If
    Name:  CustomHeader.PNG
Views: 1163
Size:  3.6 KB

    It's a fun to experiment
    Last edited by npac4o; Jan 21st, 2020 at 07:25 AM.

  22. #2502
    Member dseaman's Avatar
    Join Date
    Oct 2004
    Location
    Natal, Brazil
    Posts
    38

    Re: CommonControls (Replacement of the MS common controls)

    Now that LabelW is Windowless, does it no longer support OLEDragDrop?

  23. #2503
    Member dseaman's Avatar
    Join Date
    Oct 2004
    Location
    Natal, Brazil
    Posts
    38

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by dseaman View Post
    Now that LabelW is Windowless, does it no longer support OLEDragDrop?
    My bad. It was not Automatic. I can set Caption via Private Sub LabelW1_OLEDragDrop Event.

  24. #2504
    Member dseaman's Avatar
    Join Date
    Oct 2004
    Location
    Natal, Brazil
    Posts
    38

    Re: CommonControls (Replacement of the MS common controls)

    Duplicate post.
    Last edited by dseaman; Jan 23rd, 2020 at 12:29 AM.

  25. #2505

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,375

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by dseaman View Post
    My bad. It was not Automatic. I can set Caption via Private Sub LabelW1_OLEDragDrop Event.
    Glad you figured it out. But, LabelW was from the beginning windowless. Just for the records..

  26. #2506
    Lively Member
    Join Date
    Oct 2016
    Posts
    108

    Re: CommonControls (Replacement of the MS common controls)

    Hi!
    I am looking at the Checkbox ownerdraw event, could you please give a description of the paramaters

    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)

    thanks

  27. #2507

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,375

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by npac4o View Post
    the code above doesn't break Group.Footer, in my case the Footer works only when SubsetLink is set, otherwise, the IDE crashes. It's the same with Standard EXE Version sample.

    Code:
            With .Groups.Add(, , "Header Title")
                '.SubsetLink = "Subset Link?"
                .Footer = "Footer Title"
                .FooterAlignment = LvwGroupFooterAlignmentCenter
            End With
    Interesting. However, it applies only when the ListView1.GroupSubsetCount is > 0. (feature is enabled)

    I don't know how to solve it, seems like a comctl32.dll bug.

    But, you can workaround it by going way 1 or way 2:

    Way1:
    Code:
    With .Groups.Add(, , "Header Title")
    .SubsetLink = "" ' StrPtr <> 0
    .Footer = "Footer Title"
    .FooterAlignment = LvwGroupFooterAlignmentCenter
    End With
    Way2: (can be done of course already at design time. A new ListView has GroupSubsetCount = 0 by default)
    Code:
    ListView1.GroupSubsetCount = 0
    Quote Originally Posted by Semke View Post
    Hi!
    I am looking at the Checkbox ownerdraw event, could you please give a description of the paramaters

    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)
    Certain members of the DRAWITEMSTRUCT are passed to the OwnerDraw event.

    Code:
    typedef struct tagDRAWITEMSTRUCT {
      UINT      CtlType;
      UINT      CtlID;
      UINT      itemID;
      UINT      itemAction;
      UINT      itemState;
      HWND      hwndItem;
      HDC       hDC;
      RECT      rcItem;
      ULONG_PTR itemData;
    } DRAWITEMSTRUCT, *PDRAWITEMSTRUCT, *LPDRAWITEMSTRUCT;
    itemAction -> Action
    itemState -> State
    hDC -> hDC
    rcItem -> Left, Top, Right, Bottom

    You may find plenty of examples on the net about subclassing a checkbox and handling WM_DRAWITEM.
    So just look at those snippets and implement them accordingly into the OwnerDraw event.
    Last edited by Krool; Jan 22nd, 2020 at 04:55 PM.

  28. #2508
    Addicted Member
    Join Date
    Jul 2016
    Posts
    230

    Re: CommonControls (Replacement of the MS common controls)

    Hey

    I'm making a UserControl button using VBCCR 1.06.0059 widgets.

    The button has three states:
    • Disabled
      When disabled, the icon and text should be gray.
      Name:  home-disabled.gif
Views: 1028
Size:  356 Bytes
    • Normal
      Icon and text white.
      Name:  home-normal.gif
Views: 1024
Size:  351 Bytes
    • Hover
      Icon and text gold.
      Name:  home-hover.gif
Views: 1019
Size:  355 Bytes


    The button is made using the Image, LabelW and FrameW widgets. Some VBCCR widgets, such as LabelW and FrameW, support the MouseEnter and MouseLeave events, however the UserControl itself does not. I created procedures for LabelW and FrameW to support the MouseEnter and MouseLeave events, however they never fire. What am I doing wrong?

    I need the UserControl to change the image to "hover" when the user moves the mouse over it, and to revert the image to "normal" when the mouse leaves. Since the picture doesn't change on MouseEnter/MouseLeave, I made it change on Click to just show that the Click event works while the others don't.

    The project is attached. Note how the FrameW1_MouseMove and LabelW1_MouseMove events fire (if you uncomment them), while UserControl_MouseMove and none of the MouseEnter/MouseLeave events ever fire.

    menubutton.zip
    Last edited by OldClock; Jan 28th, 2020 at 10:27 AM. Reason: fixed gif images

  29. #2509

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,375

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by OldClock View Post
    I'm making a UserControl button using VBCCR 1.06.0059 widgets.

    The button has three states:
    • Disabled
      When disabled, the icon and text should be gray.
      Name:  home-disabled.gif
Views: 1028
Size:  356 Bytes
    • Normal
      Icon and text white.
      Name:  home-normal.gif
Views: 1024
Size:  351 Bytes
    • Hover
      Icon and text gold.
      Name:  home-hover.gif
Views: 1019
Size:  355 Bytes


    The button is made using the Image, LabelW and FrameW widgets. Some VBCCR widgets, such as LabelW and FrameW, support the MouseEnter and MouseLeave events, however the UserControl itself does not. I created procedures for LabelW and FrameW to support the MouseEnter and MouseLeave events, however they never fire. What am I doing wrong?

    I need the UserControl to change the image to "hover" when the user moves the mouse over it, and to revert the image to "normal" when the mouse leaves. Since the picture doesn't change on MouseEnter/MouseLeave, I made it change on Click to just show that the Click event works while the others don't.

    The project is attached. Note how the FrameW1_MouseMove and LabelW1_MouseMove events fire (if you uncomment them), while UserControl_MouseMove and none of the MouseEnter/MouseLeave events ever fire.
    Set .MouseTrack = True for FrameW and LabelW and try again.

  30. #2510
    Addicted Member
    Join Date
    Jul 2016
    Posts
    230

    Re: CommonControls (Replacement of the MS common controls)

    That works, thank you!

  31. #2511
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,997

    Re: CommonControls (Replacement of the MS common controls)

    Hello Krool, I'm using some of your controls in a project so thank you very much.
    I want to ask you what's the purpose of having two properties in the ScrollBar control: RightToLeft and RightToLeftLayout that need to be both set to True to set the direction RTL?

    Also I want to report that with the last version of the controls, opening the main form, selecting the ProgressBar, and pressing F4 to show the property screen, I get this error message:
    Name:  CCR_Error.jpg
Views: 1089
Size:  33.0 KB

    The message says: Expected Function or variable.

    I think it might be because you updated OLEGuids.tlb and I'm using an old version.

    Anyway the controls that I am actually using in my project are from the older version (I downloaded it about two months ago), so I don't know if it would be a good idea to register the newer OLEGuids.tlb in my case.

    I attached the image full scaled.
    Attached Files Attached Files

  32. #2512

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,375

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Eduardo- View Post
    I'm using some of your controls in a project so thank you very much.
    I want to ask you what's the purpose of having two properties in the ScrollBar control: RightToLeft and RightToLeftLayout that need to be both set to True to set the direction RTL?
    It's a complex story. Every control has it's unique treatment.
    In general, when a RightToLeft = True then apply WS_EX_RTLREADING and if RightToLeft and RightToLeftLayout = True then apply only WS_EX_LAYOUTRTL.

    Here is my internal documentation about the RightToLeft handling for each control:
    Code:
    > CoolBar
      dwMask : RightToLeftLayout = True WS_EX_LAYOUTRTL; CDDS_PREPAINT in NM_CUSTOMDRAW SetTextAlign
      Extra  : RightToLeftLayout property
    > LinkLabel
      dwMask : CDDS_PREPAINT in NM_CUSTOMDRAW SetTextAlign
      Extra  : InitReverse .Alignment; ToolTip
    > DTPicker
      dwMask : RightToLeftLayout = True WS_EX_LAYOUTRTL; EditHandle: WS_EX_RTLREADING
      Extra  : RightToLeftLayout property; Reverse .CalendarRightAligned; 
    > MonthView
      dwMask : RightToLeftLayout = True WS_EX_LAYOUTRTL
      Extra  : RightToLeftLayout property
    > Pager  
      dwMask : RightToLeftLayout = True WS_EX_LAYOUTRTL
      Extra  : RightToLeftLayout property
    > ListView
      dwMask : RightToLeftLayout = True WS_EX_LAYOUTRTL; WS_EX_RTLREADING
      Extra  : RightToLeftLayout property; ToolTip; HDF_RTLREADING
    > ComboBoxW/FontCombo
      dwMask : WS_EX_RTLREADING Or WS_EX_RIGHT Or WS_EX_LEFTSCROLLBAR
      Extra  : Clear ES_RIGHT in .hWndEdit
    > ImageCombo
      dwMask : RightToLeftLayout = True WS_EX_LAYOUTRTL; WS_EX_RTLREADING Or WS_EX_RIGHT Or WS_EX_LEFTSCROLLBAR
      Extra  : RightToLeftLayout property; Clear ES_RIGHT in .hWndEdit
    > ToolBar
      dwMask : RightToLeftLayout = True WS_EX_LAYOUTRTL; TB_SETDRAWTEXTFLAGS DT_RTLREADING
      Extra  : RightToLeftLayout property; TPM_RIGHTALIGN+TPM_LAYOUTRTL in ShowButtonMenuItems; ToolTip; Call ReCreateToolBar
    > Slider
      dwMask : RightToLeftLayout = True WS_EX_LAYOUTRTL
      Extra  : RightToLeftLayout property; ToolTip; Call ReCreateSlider
    > UpDown
      dwMask : RightToLeftLayout = True WS_EX_LAYOUTRTL
      Extra  : RightToLeftLayout property
    > ProgressBar
      dwMask : RightToLeftLayout = True WS_EX_LAYOUTRTL
      Extra  : RightToLeftLayout property
    > CommandLink
      dwMask : RightToLeftLayout = True WS_EX_LAYOUTRTL; WS_EX_RTLREADING
      Extra  : RightToLeftLayout property
    > Animation
      dwMask : RightToLeftLayout = True WS_EX_LAYOUTRTL
      Extra  : RightToLeftLayout property; Call ReCreateAnimation
    > TreeView
      dwMask : RightToLeftLayout = True WS_EX_LAYOUTRTL; TVS_RTLREADING
      Extra  : RightToLeftLayout property
    > StatusBar
      dwMask : RightToLeftLayout = True WS_EX_LAYOUTRTL; 0
      Extra  : RightToLeftLayout property; ToolTip; DrawPanel SetTextAlign
    > TabStrip
      dwMask : RightToLeftLayout = True WS_EX_LAYOUTRTL; WS_EX_RTLREADING
      Extra  : RightToLeftLayout property; MapWindowPoints; ToolTip; Call ReCreateTabStrip
    > SpinBox
      dwMask : Edit: WS_EX_RTLREADING; UpDown: 0
      Extra  : InitReverse/Reverse .Alignment; InitReverse/Reverse .TextAlignment; Remove .Orientation
    > CheckBoxW
      dwMask : WS_EX_RTLREADING
      Extra  : InitReverse .Alignment; InitReverse/Reverse .TextAlignment; InitReverse/Reverse .ImageListAlignment
    > CommandButtonW
      dwMask : WS_EX_RTLREADING
      Extra  : Reverse .Alignment; InitReverse/Reverse .ImageListAlignment; InitReverse/Reverse .SplitButtonAlignment
    > LabelW
      dwMask : DT_RTLREADING
      Extra  : InitReverse .Alignment
    > ListBoxW
      dwMask : WS_EX_RTLREADING Or WS_EX_RIGHT Or WS_EX_LEFTSCROLLBAR
      Extra  : vbListBoxCheckbox SetTextAlign
    > FrameW
      dwMask : WS_EX_RTLREADING
      Extra  : InitReverse/Reverse .Alignment
    > TextBoxW
      dwMask : WS_EX_RTLREADING Or WS_EX_LEFTSCROLLBAR
      Extra  : InitReverse .Alignment
    > RichTextBox
      dwMask : WS_EX_RTLREADING Or WS_EX_RIGHT Or WS_EX_LEFTSCROLLBAR
      Extra  : Call ReCreateRichTextBox()
    > OptionButtonW
      dwMask : WS_EX_RTLREADING
      Extra  : InitReverse .Alignment; InitReverse/Reverse .TextAlignment; InitReverse/Reverse .ImageListAlignment
    Quote Originally Posted by Eduardo- View Post
    I think it might be because you updated OLEGuids.tlb and I'm using an old version.
    Yes, just copy/paste the new OLEGuids.tlb and replace the old one.

  33. #2513
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,997

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    It's a complex story. Every control has it's unique treatment.
    In general, when a RightToLeft = True then apply WS_EX_RTLREADING and if RightToLeft and RightToLeftLayout = True then apply only WS_EX_LAYOUTRTL.
    I think I understand that you added the RightToLeft property to all controls that need to have a RightToLeftLayout property even if they are not displaying any text, just to standardize the controls properties and how they work.

    The rule is: first set RightToLeft to True, then you are allowed to also set RightToLeftLayout to True.

    Is that right?

    Quote Originally Posted by Krool View Post
    Yes, just copy/paste the new OLEGuids.tlb and replace the old one.
    But can I have any problem if I stay using the old version of the controls with the new version of OLEGuids.tlb?

  34. #2514

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,375

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Eduardo- View Post
    I think I understand that you added the RightToLeft property to all controls that need to have a RightToLeftLayout property even if they are not displaying any text, just to standardize the controls properties and how they work.

    The rule is: first set RightToLeft to True, then you are allowed to also set RightToLeftLayout to True.

    Is that right?
    Yes

    Quote Originally Posted by Eduardo- View Post
    But can I have any problem if I stay using the old version of the controls with the new version of OLEGuids.tlb?
    Yes you can have problems. What's the reason to only update one thing but not the other?

  35. #2515
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,997

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    Yes
    OK.

    Quote Originally Posted by Krool View Post
    Yes you can have problems. What's the reason to only update one thing but not the other?
    I didn't update anything.

    I just wanted to see something and for it I downloaded and opened your latest version of Common Controls project, and then I saw the error and wanted to report it.

    But no, I'm not planning to change the controls in my project often unless I have a reason. I'm just using some LabelWs, ComboBoxWs and a ProgressBar in a quite straightforward manner, mainly for supporting Unicode and RightToLeft (I'm not using the OCX version but the source code, and just what I need).

    What problem can I have if I ever register the new TLB? (I guess a lot of people can be in the same situation because I don't think that everybody is updating their projects to the latest version of the controls continuously, but they could eventually register the new TLB -on purpose or perhaps unintentionally)

  36. #2516

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,375

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Eduardo- View Post
    (I guess a lot of people can be in the same situation because I don't think that everybody is updating their projects to the latest version of the controls continuously, but they could eventually register the new TLB -on purpose or perhaps unintentionally)
    It should have been perfect from the beginning. Somehow this was not possible and I am sorry for the continuously updates..

  37. #2517
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,997

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    It should have been perfect from the beginning. Somehow this was not possible and I am sorry for the continuously updates..
    Sorry, but I think you got me wrong, I was answering to the question:

    Quote Originally Posted by Krool View Post
    What's the reason to only update one thing but not the other?
    not complaining.

    I was trying to help when I reported what I thought it could be an error.

  38. #2518
    Hyperactive Member
    Join Date
    Jan 2018
    Posts
    264

    Re: CommonControls (Replacement of the MS common controls)

    Is Windows XP supposed to be supported? I fired up a small XP VM and get some runtime errors with the Toolbar or maybe the related ImageList. I'm not planning to deploy to XP, so I won't bother looking into it any further if that OS isn't supported by VBCCR16.OCX.

  39. #2519
    Addicted Member
    Join Date
    Jul 2016
    Posts
    230

    Re: CommonControls (Replacement of the MS common controls)

    Windows XP is supported.
    Last edited by OldClock; Feb 3rd, 2020 at 10:51 AM.

  40. #2520
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,997

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    It should have been perfect from the beginning. Somehow this was not possible and I am sorry for the continuously updates..
    Sorry Krool if you got offended. It wasn't my intention.
    Sometimes we as programmers expect that everybody will update to the latest version, but for the users sometimes it is not so easy due to different reasons.

    I want to comment that I tested updating to your latest version but I experienced an issue, so I went back to the previous one.

    The issue can be seen also in your demo project.
    To do so please open MainForm and go to the code in Form_Load.
    Then put a stop watch in the first line (Call SetupVisualStylesFixes(Me)) by pressing F9.
    Press F5 to run.
    When it stops on that line, press F8 to continue step by step.

    If the problem is reproduced successfully there, you'll see that the code flow goes to the line:
    Code:
    Private Function IOleControl_AddRef(ByRef This As Long) As Long
    in VTableHandle module and does not move further by pressing F8 more times. It only resumes by pressing F5, but then lossing the possibility to run step by step.

    I also found by chance an error in your demo project: to see it click on the button "RichTextBox Demo". The test program is trying to assign a read-only property.

    HTH

Page 63 of 94 FirstFirst ... 13536061626364656673 ... 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