Page 78 of 79 FirstFirst ... 28687576777879 LastLast
Results 3,081 to 3,120 of 3138

Thread: CommonControls (Replacement of the MS common controls)

  1. #3081
    Addicted Member
    Join Date
    Jan 2012
    Posts
    148

    Re: CommonControls (Replacement of the MS common controls)

    Hi Krool,

    Thanks for the quick reply.

    I noticed that with the original toolbar, the space above and below the buttons is the same, whereas with the CCR toolbar the buttons are aligned with the bottom of the "bar". See picture below.

    Attachment 180614

    Then, for some reason I haven't yet figured out, the scaling of other controls on the main screen didn't happen correctly, resulting in the bottom of the CCR being "cut off", which made it look rather strange:

    Attachment 180615

    However, when I force the resize again, the scaling is done corectly, and the CCR toolbar looks a lot better.

    I'd still prefer the look with as much padding below as above, but that's clearly no showstopper.

    Regards,
    Erwin

  2. #3082
    Hyperactive Member
    Join Date
    Apr 2015
    Posts
    487

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Erwin69 View Post
    Would it be possible to share some sample code on how you populate the imagelist, and assign the images to the toolbar buttons? (Or do you "preset" the button Image index?)
    Sure, if you can wait until next week - I don't have access right now.
    It's really no magic.

  3. #3083

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

    Re: CommonControls (Replacement of the MS common controls)

    Erwin69,
    I can't view the images in your post.

  4. #3084
    Addicted Member
    Join Date
    Jan 2012
    Posts
    148

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    Erwin69,
    I can't view the images in your post.
    Let's try again:

    Name:  Toolbars.jpg
Views: 580
Size:  35.3 KB

    Name:  Toolbar2.png
Views: 577
Size:  21.2 KB

  5. #3085
    Hyperactive Member
    Join Date
    Apr 2015
    Posts
    487

    Re: CommonControls (Replacement of the MS common controls)

    Erwin

    For me it was too cumbersome to maintain the toolbar manually.
    Therefore I do it all by code.
    If you have a few buttons only, then it is perhaps too much effort.

    You need to use the VBCCR imagelist.
    Fill it from external DLL, or use LaVolpes image library.
    Or use BMP32 and load the images from files.
    Many possibilities.

    In my case an external DLL was wanted.

    First fill the imagelist(s) on app start:

    Code:
    Private Sub InitIconsToolbars()
    
    Dim i As VBCCR.ImageList
    Dim R As New c_ResFromDLL
    '--------------------------------------------------
    
    R.LibraryFilePath = App.Path & "\RES.dll"
    
    Set i = MF.imgl_Toolbars
    
    StartGDIPlus
    
    i.ListImages.Clear
    i.ColorDepth = ImlColorDepth32Bit
    i.ImageWidth = 0
    i.ImageHeight = 0
    
    ResDLLToImgl i, R, "new"
    ResDLLToImgl i, R, "open"
    'and 100's more
    
    Set i = Nothing
    
    StopGDIPlus
    
    R.CloseLibrary
    Set R = Nothing
    
    End Sub


    Filling a toolbar:

    Code:
    Set IL = MF.imgl_Toolbars
    ToolbarBackColor = vbWhite
    
    With tbr_Main
        .AllowCustomize = False
        .BackColor = ToolbarBackColor
        .Buttons.Clear
        Set .ImageList = IL
        .Divider = False
        .ShowTips = True
        .DoubleBuffer = True
        .Transparent = Not True
        .MinButtonWidth = 0
        .MaxButtonWidth = 0
    
        Set b = .Buttons.Add(, "new", , TbrButtonStyleDefault, "new")
        b.ToolTipText = "New"
    
        Set b = .Buttons.Add(, "open", , TbrButtonStyleDefault, "open")
        b.ToolTipText = "Open"
    
        .GetIdealSize WS, HS
        .Width = WS
        .Height = HS
         Set b = Nothing
    
    End With

  6. #3086
    Addicted Member
    Join Date
    Jan 2012
    Posts
    148

    Re: CommonControls (Replacement of the MS common controls)

    Thanks Karl. I'll need to study this a bit more.

    My app has a limited set of buttons, so manually adding these is not the issue. The challenge is more the use of transparency.

    I've taken this update as an opportunity to "modernize" the toolbar look and feel. As part of the pre-work, I collected/designed/created a series of images that are all saved in PNG-format with transparency. As that format unfortunately isn't supported by the VBCCR imagelist (and not by the original either), I need to figure out what the best approach is.

  7. #3087

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

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Erwin69 View Post
    Let's try again:

    Name:  Toolbars.jpg
Views: 580
Size:  35.3 KB

    Name:  Toolbar2.png
Views: 577
Size:  21.2 KB
    Ok. I am just wondering what I should do then. Just add a magic space then ?

  8. #3088
    Addicted Member
    Join Date
    Jan 2012
    Posts
    148

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    Ok. I am just wondering what I should do then. Just add a magic space then ?
    Unless it's simple, and you feel that it improves the look and feel of the CCR Toolbar, I wouldn't do anything.

    From my point of view it would be a small cosmic improvement that would be nice to have, but most definitely not a showstopper or worth a significant amount of effort.

  9. #3089
    Lively Member
    Join Date
    Oct 2016
    Posts
    72

    Re: CommonControls (Replacement of the MS common controls)

    Karl

    could you please elaborate on lines of code you entered


    Code:
    Dim R As New c_ResFromDLL
    '--------------------------------------------------
    
    R.LibraryFilePath = App.Path & "\RES.dll"
    
    Set i = MF.imgl_Toolbars
    
    StartGDIPlus
    
    i.ListImages.Clear
    i.ColorDepth = ImlColorDepth32Bit
    i.ImageWidth = 0
    i.ImageHeight = 0
    
    ResDLLToImgl i, R, "new"
    ResDLLToImgl i, R, "open"
    'and 100's more
    
    Set i = Nothing
    
    StopGDIPlus
    
    R.CloseLibrary
    Set R = Nothing
    
    could you please point me to a link where i can get this class c_ResFromDLL, it would be quite helpful for me.
    also the GDIPlus Library

    thanks

  10. #3090
    Hyperactive Member
    Join Date
    Apr 2015
    Posts
    487

    Re: CommonControls (Replacement of the MS common controls)

    Here's the DLL and PNG stuff.
    It is quite old and probably there are more elegant solutions.
    Also it is a adjusted to my needs.

    PNG_etc.zip

    I think #3089 is answered when you inspect the libs.
    Last edited by Karl77; Mar 18th, 2021 at 01:40 AM.

  11. #3091
    Lively Member
    Join Date
    Oct 2016
    Posts
    72

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Karl77 View Post
    Here's the DLL and PNG stuff.
    It is quite old and probably there are more elegant solutions.
    Also it is a adjusted to my needs.

    PNG_etc.zip

    I think #3089 is answered when you inspect the libs.
    Thanks, I am making good use out of it, and saved a lot of time by not doing it myself

  12. #3092

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

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Erwin69 View Post
    Unless it's simple, and you feel that it improves the look and feel of the CCR Toolbar, I wouldn't do anything.

    From my point of view it would be a small cosmic improvement that would be nice to have, but most definitely not a showstopper or worth a significant amount of effort.
    I would like to help you.. it's just that in this case I have not the answer..

  13. #3093
    Addicted Member
    Join Date
    Jan 2012
    Posts
    148

    Re: CommonControls (Replacement of the MS common controls)

    Hi Krool, don't worry about the extra space below the buttons. As said, it's a small cosmic improvement not worth a lot of trouble. Rest assured that your help is greatly appreciated either way!

    However, something is puzzling me with the Toolbar.

    The layout of my main screen is a menu-bar and the toolbar on top, and a statusbar at the bottom. In between there is a picturebox that serves as a "container" for a range of other controls.

    I assigned 32x32 pixel images to the toolbar buttons using a CCR imagelist, giving the toolbar a Height of 630. This is what I see in the IDE, and what is saved in the frm-file. However, at application startup, the size is reported as 390, which messes up the resizing and positioning of the container and the items in it. After the form-resize event, it actually correctly reports the height of 630 for the toolbar, so I've moved some code around to do the resizing of the other controls at a later stage. Which works fine.

    But, now I have the strange thing that the container part of the screen is not painted after the resize and reposition. Only when I move the mouse over the toolbar, or over the statusbar at the bottom, the center of the screen is "refreshed" and properly painted. This happens when the app is run from the IDE as well as compiled.

    I realize that this is vague, and for sure don't claim it's related to the CCR toolbar, but I've been killing myself for many hours in the last several days to figure out what is causing this, and still have no clue. Hopefully the description rings a bell for someone to point me in the right direction.

  14. #3094

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

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Erwin69 View Post
    Hi Krool, don't worry about the extra space below the buttons. As said, it's a small cosmic improvement not worth a lot of trouble. Rest assured that your help is greatly appreciated either way!

    However, something is puzzling me with the Toolbar.

    The layout of my main screen is a menu-bar and the toolbar on top, and a statusbar at the bottom. In between there is a picturebox that serves as a "container" for a range of other controls.

    I assigned 32x32 pixel images to the toolbar buttons using a CCR imagelist, giving the toolbar a Height of 630. This is what I see in the IDE, and what is saved in the frm-file. However, at application startup, the size is reported as 390, which messes up the resizing and positioning of the container and the items in it. After the form-resize event, it actually correctly reports the height of 630 for the toolbar, so I've moved some code around to do the resizing of the other controls at a later stage. Which works fine.

    But, now I have the strange thing that the container part of the screen is not painted after the resize and reposition. Only when I move the mouse over the toolbar, or over the statusbar at the bottom, the center of the screen is "refreshed" and properly painted. This happens when the app is run from the IDE as well as compiled.

    I realize that this is vague, and for sure don't claim it's related to the CCR toolbar, but I've been killing myself for many hours in the last several days to figure out what is causing this, and still have no clue. Hopefully the description rings a bell for someone to point me in the right direction.
    It's the ImageList. Once without (390) and then with (630).
    This is a dilemma by design. The ImageList property is saved as string in the CCR ToolBar.
    I cannot lookup the ImageList Object during UserControl_ReadProperties as the order in which VB loads the control cannot be influenced.
    So doing the lookup in UserControl_ReadProperties would be a luck game. Can work or not.
    That's why an inteenal VB.Timer is used for that (only when needed, for ImageList) and it is ensured to fire when everything is safe. However that is AFTER the Form_Load event.
    You can FIX this dilemma actually by code in Form_Load:
    Code:
    Set ToolBar1.ImageList = ToolBar1.ImageList ' Force internal lookup now

  15. #3095
    Hyperactive Member
    Join Date
    Apr 2015
    Posts
    487

    Re: CommonControls (Replacement of the MS common controls)

    I use a pager for every toolbar.
    This works very well and is only visible when the form is too small to show the full toolbar.
    I set the buddy by code, because in the IDE it doesn't work so good.

    The toolbar size is correct when I use this after populating the toolbar:
    Code:
    .GetIdealSize WS, HS
    .Width = WS
    .Height = HS
    On positioning the toolbar without a pager, I don't care about the toolbar height.
    I use the first button as the reference.
    This way extra space below the buttons doesn't hurt.

  16. #3096
    Addicted Member
    Join Date
    Jan 2012
    Posts
    148

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    It's the ImageList. Once without (390) and then with (630).
    This is a dilemma by design. The ImageList property is saved as string in the CCR ToolBar.
    I cannot lookup the ImageList Object during UserControl_ReadProperties as the order in which VB loads the control cannot be influenced.
    So doing the lookup in UserControl_ReadProperties would be a luck game. Can work or not.
    That's why an inteenal VB.Timer is used for that (only when needed, for ImageList) and it is ensured to fire when everything is safe. However that is AFTER the Form_Load event.
    You can FIX this dilemma actually by code in Form_Load:
    Code:
    Set ToolBar1.ImageList = ToolBar1.ImageList ' Force internal lookup now
    Thanks Krool. That fixed it, and it did also help me to find the solution for the other problem.

  17. #3097
    Addicted Member
    Join Date
    Jan 2012
    Posts
    148

    Re: CommonControls (Replacement of the MS common controls)

    Yet another question on the toolbar...

    I've added image lists for the active buttons, and for disabled buttons. I have a separate routine that enables/disables menu-items and toolbar buttons depending on availablilty of data.

    It runs at app startup, after which a number of the buttons are disabled. Then when load a file, it is run again, to enable the applicable buttons. So far, so good. However, after the routine is run, the toolbar is not repainted until the mouse moves over it. Even the explicit instruction to Refresh doesn't change that behavior.

    Is there a setting / instruction that I'm overlooking?

  18. #3098

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

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Erwin69 View Post
    Yet another question on the toolbar...

    I've added image lists for the active buttons, and for disabled buttons. I have a separate routine that enables/disables menu-items and toolbar buttons depending on availablilty of data.

    It runs at app startup, after which a number of the buttons are disabled. Then when load a file, it is run again, to enable the applicable buttons. So far, so good. However, after the routine is run, the toolbar is not repainted until the mouse moves over it. Even the explicit instruction to Refresh doesn't change that behavior.

    Is there a setting / instruction that I'm overlooking?
    Can you bundle a small demo showing the problem ? I can't replicate it. Thanks

  19. #3099
    Addicted Member
    Join Date
    Feb 2015
    Location
    Colorado USA
    Posts
    180

    Re: CommonControls (Replacement of the MS common controls)

    Version 3 of the Documentation and Compile Utility for Krool's controls has been released here.

    MountainMan

  20. #3100
    Addicted Member
    Join Date
    Jan 2012
    Posts
    148

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    Can you bundle a small demo showing the problem ? I can't replicate it. Thanks
    When I isolated the toolbar as the only control on a separate from, it worked correctly, so there must be something else that has an influence. I will have to investigate further.

  21. #3101
    Addicted Member
    Join Date
    Jan 2012
    Posts
    148

    Re: CommonControls (Replacement of the MS common controls)

    While Iím finetuning the implementation of the VBCCR components in my application, I discovered a significant performance issue in one area.

    Iím using the following steps to show the user a combo with only unique values:

    1. All items are added to a sorted listview
    2. Then go through the listview from the top, removing double items
    3. Last, the remaining items are added to the dropdown

    Using a 1000 records dataset, these were the results:

    - Using a sorted Microsoft Common Controls listview, the process takes 25 milliseconds.
    - Using a sorted VBCCR listview, the process takes 21030 milliseconds.
    - Using a non-sorted VBCCR listview, filling it, setting sorting to true, and then do the rest of the process, takes 138 milliseconds.

    The first and third approach broken down:

    Microsoft ListView
    Fill Listview 8 ms
    Remove Doubles 14 ms
    Fill Combo 3 ms

    VBCCR ListView
    Fill Listview 28 ms
    Switch to sorted 65 ms
    Remove Doubles 40 ms
    Fill Combo 5 ms

    The ListView basically has all properties set to False, except for Enabled, as it's only used behind the scenes, and therefore doesn't need to be displayed, refreshed, etc.

    Note: no further action is expected from my side as I can live with the 138 ms, but I thought to share this to show that different approaches can make a massive difference.

  22. #3102
    Fanatic Member
    Join Date
    Jan 2016
    Posts
    593

    Re: CommonControls (Replacement of the MS common controls)

    Please Krool help me regarding this point
    Tutorial:
    The "Development" machine needs to register the VBCCR17.OCX as usual and use the components for e.g. in a Std-EXE project.
    The source project needs to include the Side-by-side resources. (see below)
    Then on the "End user" machine you only need the VBCCR17.OCX and the .exe (Std-EXE project) on the same folder.
    It will work then without any registration.
    I followed these steps for VBFlexGrid and everything is working fine on the end user machine.
    However I failed to do so with common controls.
    I'll tell you about all the steps I did.
    I used the Resource Hacker utility to add the VBCCR17SideBySide.res to the VBFLXGRD14SideBySideAndVisualStyles.res
    Once they are compiled in one file I added them to the project.
    I placed the VBCCR17.OCX and the VBFLXGRD14.OCX in the .exe folder.
    I still have no issue with the VBFLXGRD14 but I'm having error with the VBCCR17
    ďComponent 'VBCCR17. OCX' or one of its dependencies not correctly registered: a file is missing or invalidĒ
    On The "Development" machine, I have no issue
    Thank you in advance

  23. #3103

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

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Erwin69 View Post
    While Iím finetuning the implementation of the VBCCR components in my application, I discovered a significant performance issue in one area.

    Iím using the following steps to show the user a combo with only unique values:

    1. All items are added to a sorted listview
    2. Then go through the listview from the top, removing double items
    3. Last, the remaining items are added to the dropdown

    Using a 1000 records dataset, these were the results:

    - Using a sorted Microsoft Common Controls listview, the process takes 25 milliseconds.
    - Using a sorted VBCCR listview, the process takes 21030 milliseconds.
    - Using a non-sorted VBCCR listview, filling it, setting sorting to true, and then do the rest of the process, takes 138 milliseconds.

    The first and third approach broken down:

    Microsoft ListView
    Fill Listview 8 ms
    Remove Doubles 14 ms
    Fill Combo 3 ms

    VBCCR ListView
    Fill Listview 28 ms
    Switch to sorted 65 ms
    Remove Doubles 40 ms
    Fill Combo 5 ms

    The ListView basically has all properties set to False, except for Enabled, as it's only used behind the scenes, and therefore doesn't need to be displayed, refreshed, etc.

    Note: no further action is expected from my side as I can live with the 138 ms, but I thought to share this to show that different approaches can make a massive difference.
    Well. The MS ListView will sort kind of "PostMessage" style so you cannot compare it directly.
    I think that the VBCCR ListView will sort "directly" is rather a feature than a bug.
    You do it correctly that you disable the sort while populating.
    I found some spots where maybe a few milliseconds can be saved (e.g. store AddressOf in a variable etc.) When sorting after each insert. However, that fact is neglibile when sorting only once when insertions are finished.

    But you can improve by eliminating the duplicates already in the recordset. Also the sorting could be outsourced to the recordset. And ultimate performance would be to make the ListView virtual and fetch the visible viewport data from the recordset only when needed.

  24. #3104
    Lively Member
    Join Date
    Jul 2017
    Posts
    119

    Re: CommonControls (Replacement of the MS common controls)

    VB6sp6
    VBCCR 1.7.12

    i found a autoresize-bug at the StatusBar-control.
    the width of the 2. panel doesnt resize after changing the content.
    i have statusbar with 3 panels:
    1.panel autoresize=spring
    2.panel autoresize=content
    3.panel autoresize=content

    example:
    the 2. panel displays the text "1". after i change the text to "10000" the panel doesnt resize to the new content.
    setting the autoresize property to "content" again triggers the 2. panel resize.
    changing the width of the statusbar also triggers the 2. panel resize.
    the 3. panel always resize correct after changing the content!
    Last edited by Mith; Apr 11th, 2021 at 10:12 PM.

  25. #3105

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

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Mith View Post
    VB6sp6
    VBCCR 1.7.12

    i found a autoresize-bug at the StatusBar-control.
    the width of the 2. panel doesnt resize after changing the content.
    i have statusbar with 3 panels:
    1.panel autoresize=spring
    2.panel autoresize=content
    3.panel autoresize=content

    example:
    the 2. panel displays the text "1". after i change the text to "10000" the panel doesnt resize to the new content.
    setting the autoresize property to "content" again triggers the 2. panel resize.
    changing the width of the statusbar also triggers the 2. panel resize.
    the 3. panel always resize correct after changing the content!
    I found the bug. The blue marked code fixes the issue of not auto-resizing after changing the panel text.
    Update will follow soon...
    Code:
    Friend Property Let FPanelText(ByVal Index As Long, ByVal Value As String)
    If StatusBarHandle <> 0 Then
        PropShadowPanels(Index).Text = Replace$(Value, vbTab, vbNullString)
        Call SetPanelText(Index)
        If PropShadowPanels(Index).AutoSize = SbrPanelAutoSizeContent Then Call SetParts
    End If
    End Property
    Last edited by Krool; Apr 12th, 2021 at 02:59 PM.

  26. #3106
    Addicted Member
    Join Date
    Jan 2012
    Posts
    148

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    I think that the VBCCR ListView will sort "directly" is rather a feature than a bug.
    I agree.

    Quote Originally Posted by Krool View Post
    I found some spots where maybe a few milliseconds can be saved (e.g. store AddressOf in a variable etc.) When sorting after each insert. However, that fact is neglibile when sorting only once when insertions are finished.
    I wouldn't bother if I were you.

    Quote Originally Posted by Krool View Post
    But you can improve by eliminating the duplicates already in the recordset. Also the sorting could be outsourced to the recordset. And ultimate performance would be to make the ListView virtual and fetch the visible viewport data from the recordset only when needed.
    The dataset is a collection of a custom class, not a recordset. There actually are multiple, but one example is CProduct, with properties like ID, Name, Supplier. I'm using the described process with a sorted ListView to get a list of Suppliers without duplicates. It seemed the simplest and quickest approach back in the days when I added that feature.

  27. #3107
    Addicted Member
    Join Date
    Jan 2012
    Posts
    148

    Re: CommonControls (Replacement of the MS common controls)

    Hi Krool,

    Question about the VBFlexgrid:

    I switch redraw off, and add 1000 rows with 50 columns. This takes 0.7 seconds.

    Then I set sorting to one column (flexSortStringAscending). This takes 10.1 seconds. (With Redraw still off.)

    Am I missing some setting, or is the grid sorting simply slow, and am I better of using a temp recordset in memory to sort, and the (re-)populate the grid?

    Thanks,
    Erwin

  28. #3108

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

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Erwin69 View Post
    Hi Krool,

    Question about the VBFlexgrid:

    I switch redraw off, and add 1000 rows with 50 columns. This takes 0.7 seconds.

    Then I set sorting to one column (flexSortStringAscending). This takes 10.1 seconds. (With Redraw still off.)

    Am I missing some setting, or is the grid sorting simply slow, and am I better of using a temp recordset in memory to sort, and the (re-)populate the grid?

    Thanks,
    Erwin
    I just did a test with 1000 rows and 50 column. The sorting takes 0.2 seconds in IDE.
    Can you provide a demo ?
    Last edited by Krool; Apr 12th, 2021 at 05:02 PM.

  29. #3109
    Lively Member
    Join Date
    Jul 2017
    Posts
    119

    Re: CommonControls (Replacement of the MS common controls)

    the statusbar-panel-autoresize-bug is fixed with OCX v1.7.14!
    thx you!

  30. #3110
    Addicted Member
    Join Date
    Jan 2012
    Posts
    148

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    I just did a test with 1000 rows and 50 column. The sorting takes 0.2 seconds in IDE.
    Can you provide a demo ?
    Knowing that the grid could be fast, I investigated further and discovered that it's the SelectionMode setting that is causing the slowness. If I set it to FlexSelectionModeFree the sorting is indeed as fast as you mentioned. However, if I set it to FlexSelectionModeByRow it takes the 10 seconds I mentioned. I'm treating that setting like the Redraw now, off before sorting, and then back on, and performance is good.

    One additional question, when a row is selected, the cell in the first column doesn't get the background color even if SelectionMode is set to FlexSelectionModeByRow. Is there a way around that?

    Edit: you can ignore the additional question. I realized that it is the FocusRect setting that was not set to None.
    Last edited by Erwin69; Apr 13th, 2021 at 04:46 AM.

  31. #3111
    Lively Member
    Join Date
    Oct 2016
    Posts
    72

    Re: CommonControls (Replacement of the MS common controls)

    I have noticed on the DateTimePicker when CustomFormat is "dd/MM/yyyy hh:mm:ss", that its problematic when you try editing.
    AllowUserInput is enabled, the selection of individual values (day, month, year, hour, minute, second) with the mouse selects the whole text.

  32. #3112

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

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Erwin69 View Post
    Knowing that the grid could be fast, I investigated further and discovered that it's the SelectionMode setting that is causing the slowness. If I set it to FlexSelectionModeFree the sorting is indeed as fast as you mentioned. However, if I set it to FlexSelectionModeByRow it takes the 10 seconds I mentioned. I'm treating that setting like the Redraw now, off before sorting, and then back on, and performance is good.
    LOL.
    It's not a bug but a feature. In fact you are doing a 50 multi-column sort. You just were lucky with the selection mode 'Free' to have not a selection which spans multiple columns.

    The code below will help you out to sort only a particular column (for all rows) and it works for every selection mode.

    Code:
    Dim MyColToSort As Long
    MyColToSort = 5 ' or whatever else you have as input
    
    Dim Row1 As Long, Row2 As Long, Col1 As Long, Col2 As Long
    With VBFlexGrid1
    Row1 = .Row: Row2 = .RowSel: Col1 = .Col: Col2 = .ColSel
    .SelectRange Row1, MyColToSort, Row1, MyColToSort ' Ensure single col sort for all rows
    .Sort = FlexSortStringAscending
    .SelectRange Row1, Col1, Row2, Col2 ' Restore selection
    End With
    Quote Originally Posted by Semke View Post
    I have noticed on the DateTimePicker when CustomFormat is "dd/MM/yyyy hh:mm:ss", that its problematic when you try editing.
    AllowUserInput is enabled, the selection of individual values (day, month, year, hour, minute, second) with the mouse selects the whole text.
    Thats the point for AllowUserInput at all. To allow a text free entry. You need to parse the input accordingly in the "ParseUserInput" event.
    If you don't want this turn AllowUserInput off (=False, which is the default)
    Last edited by Krool; Apr 13th, 2021 at 06:58 AM.

  33. #3113
    Lively Member
    Join Date
    Oct 2016
    Posts
    72

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    LOL.
    Thats the point for AllowUserInput at all. To allow a text free entry. You need to parse the input accordingly in the "ParseUserInput" event.
    If you don't want this turn AllowUserInput off (=False, which is the default)
    Thanks, this is when We bang our heads and say "how stupid am I"

  34. #3114
    Addicted Member
    Join Date
    Jan 2012
    Posts
    148

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    LOL.
    It's not a bug but a feature. In fact you are doing a 50 multi-column sort. You just were lucky with the selection mode 'Free' to have not a selection which spans multiple columns.
    OK, then it makes sense that it needed a bit more time to sort.

    I'm using version 1.04.0032 of the VBFlexgrid OCX. SelectRange is an unknown property?

    Would this approach give the same result as your code example?

    Code:
    With VBFlexGrid1
         .SelectionMode = FlexSelectionModeFree
         .Redraw = False
         .col = iColumn
         .Sort = flexSortStringAscending
         .SelectionMode = FlexSelectionModeByRow
         .Redraw = True
    End With

  35. #3115

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

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Erwin69 View Post
    OK, then it makes sense that it needed a bit more time to sort.

    I'm using version 1.04.0032 of the VBFlexgrid OCX. SelectRange is an unknown property?

    Would this approach give the same result as your code example?

    Code:
    With VBFlexGrid1
         .SelectionMode = FlexSelectionModeFree
         .Redraw = False
         .col = iColumn
         .Sort = flexSortStringAscending
         .SelectionMode = FlexSelectionModeByRow
         .Redraw = True
    End With
    Not assured. If the row sel "range" is more than 1 only those rows will be sorted.
    So a extra .RowSel = .Row would help.

  36. #3116
    Addicted Member
    Join Date
    Jan 2012
    Posts
    148

    Re: CommonControls (Replacement of the MS common controls)

    In my grid I have also columns with percentages (e.g. 7.3% and 54.9%) and columns with dimensions (e.g. 7.2cm and 14.6cm or 3.1" and 6.2"). MSFlexgrid sorts these without problems using the Numeric sorts, but the VBFlexGrid doesn't. What is the recommended way to sort these?

  37. #3117

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

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Erwin69 View Post
    In my grid I have also columns with percentages (e.g. 7.3% and 54.9%) and columns with dimensions (e.g. 7.2cm and 14.6cm or 3.1" and 6.2"). MSFlexgrid sorts these without problems using the Numeric sorts, but the VBFlexGrid doesn't. What is the recommended way to sort these?
    Need to test... and if something needs to be enhanced.
    Worst case "custom sort option" which raise event.

    Edit: you may store the percentage as number only and use .ColFormat property to add the "%" char as formatting. Thus the sort would work as immediate solution.

    Btw. you can sort also using the cell property
    Code:
    .Cell(FlexCellSort, Row1, Col1, Row2, Col2) = flexSortStringAscending
    This way you don't need to bother change row col etc. and to restore it..

    Edit: please continue in the VBFlexGrid thread!
    Last edited by Krool; Apr 13th, 2021 at 01:11 PM.

  38. #3118
    Hyperactive Member
    Join Date
    Apr 2015
    Posts
    487

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    Edit: please continue in the VBFlexGrid thread!
    Why not combine the 2 projects?
    I think it is unlikely that a VBFlexGrid user doesn't use VBCCR...
    Just a thought.

  39. #3119
    Lively Member
    Join Date
    Jul 2017
    Posts
    119

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Karl77 View Post
    Why not combine the 2 projects?
    I think it is unlikely that a VBFlexGrid user doesn't use VBCCR...
    Just a thought.
    Im a VBCCR user and i dont use VBFlexGrid and for me it looks like someone spams the forum with postings not related to VBCCR...

  40. #3120
    Frenzied Member
    Join Date
    Jan 2020
    Posts
    1,274

    Re: CommonControls (Replacement of the MS common controls)

    I'm sorry about that.
    I'm not dissatisfied, I'm just saying that the control is very good.It is suggested to add some transparent functions, because 99% of people do not have the ability to modify it at all.After all, all VB.NET controls are transparent.Today, 23 years later, we are developing a basic control with some new elements. Such as a transparent background or translucent mask.

Page 78 of 79 FirstFirst ... 28687576777879 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