PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
VBFlexGrid Control (Replacement of the MSFlexGrid control) - Page 7-VBForums
Page 7 of 9 FirstFirst ... 456789 LastLast
Results 241 to 280 of 326

Thread: VBFlexGrid Control (Replacement of the MSFlexGrid control)

  1. #241

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Eduardo- View Post
    My vote is for Option A. Implement the new behavior and do not add any new property.
    If there are two or three VB6 programmers in the world that added code to fix that bug of the origonal FlexGrids and they decide to replace the controls with your Flex version, if they are lucky they'll read somewhere about the new behaviour and remove their fixing code (unlikely to happen) and if not, they at some point will notice the strange behavior and will realize that they must remove their fixing code because your control doesn't have the bug.

    Adding new properties for things like this is confusing for the majority of people that never knew about the bug.
    For example I use FlexGrids since many years ago but I never realized about this bug.

    Because, let's see:
    Lets suppose that the CompatibilyMode is False by default.
    All the people that will use your Flex version will have the bug, unless they read somewhere that they must switch that property to True. Then 99.9% of the people will have the bug as the original had because almost nobody reads such things.
    On the other hand, if the CompatibilityMode is True by default, the problem will be for the two or three in the whole world that wrote code to fix that bug (but just in the case that these 2 or 3 find your control and decide to replace the old ones with yours). Because the same thing: nobody reads about such things.
    And in the case that it happens to some final users, what would be the "big problem"? It is only that with the keyboard the user will scroll two rows instead of one.
    If it happens that might be one program goes out with that "problem", perhaps three or four final users will notice the weirdness of the scroll with the keyboard and decide to use the mouse instead.
    Good arguments of how it works in the pactice.. Only in a perfect world it would work.

    So, I improved then with today's update (when SelectionMode is ByRow/ByCol) the cursor key navigating. (also when shift or ctrl key is concerned)
    No new property is included. It's just as is.

  2. #242

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    This update is not a real bugfix, but rather a compatibility fix in regard to MSFlexGrid.

    In VBFlexGrid and MSFlexGrid the CellLeft/CellTop property returns the real X/Y coord of an cell.
    However, for CellWidth/CellHeight the behavior was different.
    The VBFlexGrid returned the real CX/CY values whereas the MSFlexGrid has an offset of -1 for each.

    Reason is that the CellWidth/CellHeight are designed to be used in combination with placing a TextBox on a cell. With that -1 offset it looks better.
    So in order to be compatible I also made now the -1 offset.
    Of course there is then the fact that a row or col with an real height/width of 0 (not visible) will return a negative width. (-1)
    But MSFlexGrid is doing the same so..

  3. #243

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Bugfix in FormatString property.

    When no alignment prefix for a column was specified (no '<', '^' or '>') then FlexAlignmentGeneral should have been used instead FlexAlignmentLeftCenter.

    Now with FlexAlignmentGeneral it equals MSFlexGrid behavior.

  4. #244

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Further bugfix. This time CellWrapBehavior property was affected.
    The cursor keys move the focus accordingly in the grid and skips hidden or zero height/width rows/cols.
    However, that "skip movement" did not work for CellWrapBehavior when the first or last scrollable (non-fixed) rows/cols were hidden or zero height/width.
    That's now fixed.

  5. #245
    New Member
    Join Date
    Nov 2018
    Posts
    2

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    undefined Code:
    1. Dim k As Long
    2. For k = 0 To Me.VBFlexGrid1.Cols - 1
    3. Debug.Print "Debug.Print ColIndex= " & k & "   GetColKeyByIndex =  " & Me.VBFlexGrid1.ColKey(k)
    4. Next  
    5. 'Debug.Print ColIndex= 0   GetColKeyByIndex =
    6. 'Debug.Print ColIndex= 1   GetColKeyByIndex =
    7. 'Debug.Print ColIndex= 2   GetColKeyByIndex =
    8. 'Debug.Print ColIndex= 3   GetColKeyByIndex =
    9. 'Debug.Print ColIndex= 4   GetColKeyByIndex =
    10. 'Debug.Print ColIndex= 5   GetColKeyByIndex =
    11. 'Debug.Print ColIndex= 6   GetColKeyByIndex =
    12. 'Debug.Print ColIndex= 7   GetColKeyByIndex =
    13. 'Debug.Print ColIndex= 8   GetColKeyByIndex =
    14. 'Debug.Print ColIndex= 9   GetColKeyByIndex =
    15. 'Debug.Print ColIndex= 10   GetColKeyByIndex =
    16. 'Debug.Print ColIndex= 11   GetColKeyByIndex =
    17. 'Debug.Print ColIndex= 12   GetColKeyByIndex =
    18. 'Debug.Print ColIndex= 13   GetColKeyByIndex =
    19. 'Debug.Print ColIndex= 14   GetColKeyByIndex =
    20. 'Debug.Print ColIndex= 15   GetColKeyByIndex =
    21. 'Debug.Print ColIndex= 16   GetColKeyByIndex =
    22. 'Debug.Print ColIndex= 17   GetColKeyByIndex =
    23. 'Debug.Print ColIndex= 18   GetColKeyByIndex =
    24. 'Debug.Print ColIndex= 19   GetColKeyByIndex =

    Debug.Print "Debug.Print ColIndex= " & k & " GetColKeyByIndex = " & Me.VBFlexGrid1.ColKey(k)=Null ?

  6. #246

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by smileyoufucn View Post
    undefined Code:
    1. Dim k As Long
    2. For k = 0 To Me.VBFlexGrid1.Cols - 1
    3. Debug.Print "Debug.Print ColIndex= " & k & "   GetColKeyByIndex =  " & Me.VBFlexGrid1.ColKey(k)
    4. Next  
    5. 'Debug.Print ColIndex= 0   GetColKeyByIndex =
    6. 'Debug.Print ColIndex= 1   GetColKeyByIndex =
    7. 'Debug.Print ColIndex= 2   GetColKeyByIndex =
    8. 'Debug.Print ColIndex= 3   GetColKeyByIndex =
    9. 'Debug.Print ColIndex= 4   GetColKeyByIndex =
    10. 'Debug.Print ColIndex= 5   GetColKeyByIndex =
    11. 'Debug.Print ColIndex= 6   GetColKeyByIndex =
    12. 'Debug.Print ColIndex= 7   GetColKeyByIndex =
    13. 'Debug.Print ColIndex= 8   GetColKeyByIndex =
    14. 'Debug.Print ColIndex= 9   GetColKeyByIndex =
    15. 'Debug.Print ColIndex= 10   GetColKeyByIndex =
    16. 'Debug.Print ColIndex= 11   GetColKeyByIndex =
    17. 'Debug.Print ColIndex= 12   GetColKeyByIndex =
    18. 'Debug.Print ColIndex= 13   GetColKeyByIndex =
    19. 'Debug.Print ColIndex= 14   GetColKeyByIndex =
    20. 'Debug.Print ColIndex= 15   GetColKeyByIndex =
    21. 'Debug.Print ColIndex= 16   GetColKeyByIndex =
    22. 'Debug.Print ColIndex= 17   GetColKeyByIndex =
    23. 'Debug.Print ColIndex= 18   GetColKeyByIndex =
    24. 'Debug.Print ColIndex= 19   GetColKeyByIndex =

    Debug.Print "Debug.Print ColIndex= " & k & " GetColKeyByIndex = " & Me.VBFlexGrid1.ColKey(k)=Null ?
    And what?

  7. #247

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by dreammanor View Post
    In Farpoint Spread and my Spread, there are not only the SelectionMode (SelectBlockOptions, which is more powerful than the SelectionMode of VBFlexGrid) property, but also the OperationMode property, whose values are: OperationModeNormal, OperationModeRead, OperationModeRow, OperationModeSingle, OperationModeMulti, OperationModeExtended.

    When OperationMode=OperationModeRow, the spread is in single-row selection mode, which is a very useful mode. That's why I recommend adding an enum value FlexSelectionModeBySingleRow to your VBFlexGrid.

    If you want to add a property, I suggest you add the OperationMode property instead of CompatibilityMode. The name CompatibilityMode is too abstract and can be confusing to the users.
    I want to come back to this topic.
    On 02-Mar-2019 I fixed some cumbersome behavior already for ByRow/ByCol selection mode in regard to scrolling with the arrow keys.

    I would like to add a selection mode where the active cell (focused cell) can be changed by the arrow keys within that "full row/col selection".
    However, I want to keep that behavior for ByRow/ByCol that changing the focused cell is not possible. To maintain compatibility to MSFlexGrid. That's why I need new enum values for SelectionMode or another property controlling it.

    So how to name it the best? You suggested to add something like "FlexSelectionModeBySingleRow". But SingleRow sounds for me like the current ByRow behavior (where focused cell cannot be moved both directions) and not the new behavior ?

    Maybe "FlexSelectionModeFreeByRow" ? That would sound for me like the desired behavior, a mix of Free and ByRow combined into one.
    It would work like FlexSelectionModeFree, but just drawing the full row (or full column) as selected.

  8. #248
    New Member
    Join Date
    Nov 2018
    Posts
    2

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Please forgive me for not speaking English. Content can only be sent using Google Translate.
    Problem: The value cannot be obtained normally through the ColKey property
    Is this my method problem or bug?

  9. #249
    Frenzied Member
    Join Date
    Sep 2012
    Posts
    1,598

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    FlexSelectionModeByRowExtended Or FlexSelectionModeByRowEx

    FlexSelectionModeByColumnExtended Or FlexSelectionModeByColumnEx

  10. #250

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by smileyoufucn View Post
    Problem: The value cannot be obtained normally through the ColKey property
    Is this my method problem or bug?
    Your usage is wrong. See below illustration how it can be used.

    Code:
    Private Sub CommandTest_Click()
    Dim Col As Long
    Col = 5
    MsgBox VBFlexGrid1.ColKey(Col) ' will return blank
    VBFlexGrid1.ColKey(Col) = "my key"
    MsgBox VBFlexGrid1.ColIndex("my key") ' will return 5
    MsgBox VBFlexGrid1.ColIndex("my key") ' will return again 5
    MsgBox VBFlexGrid1.ColKey(Col) ' will return 'my key'
    End Sub
    Quote Originally Posted by dreammanor View Post
    FlexSelectionModeByRowExtended Or FlexSelectionModeByRowEx

    FlexSelectionModeByColumnExtended Or FlexSelectionModeByColumnEx
    Thanks. However, I think will gonna stick to wording 'FlexSelectionModeFreeByRow' and 'FlexSelectionModeFreeByColumn'.
    I do find correct wordings quite important and feel that this would express the behavior more exactly instead of Extended.

  11. #251

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Karl77 View Post
    Is there an edit function in the works?
    Update released. Now the in-cell editing functionality is finally implemented.

    The new AllowUserEditing property determines if the start of the edit is handled automatically.
    It will then be start automatically when:
    - F2 key
    - Space key
    - Keystroke/typing
    - Double click

    It can also be started by code using the StartEdit method, even if AllowUserEditing is False.

    The edit will end when:
    - Losing focus
    - Escape key
    - Return key
    - Tab/ShifTab key (meaningful only when TabBehavior <> Controls; otherwise it's just a LostFocus)
    - Navigation key (four Arrow keys, PageUp, PageDown, Home and End keys)

    The edit can also be ended by code using the CancelEdit or CommitEdit method.
    CancelEdit discard the changes whereas CommitEdit saves the changes.

    There are several read-only run-time properties:
    - hWndEdit As Long
    - EditRow As Long
    - EditCol As Long
    - EditReason As FlexEditReasonConstants
    - EditCloseMode As FlexEditCloseModeConstants

    And following run-time properties which are not read-only:
    - EditText As String
    - EditMaxLength As Long
    - EditSelStart As Long
    - EditSelLength As Long
    - EditSelText As String

    The chart below will illustrate the flow of the various events:

    Name:  FlexEditEventsFlowChart.png
Views: 302
Size:  17.4 KB

    To note is that when invoking by code the CommitEdit event that the ValidateEdit event is still triggered.
    Inside ValidateEdit you can force validation by again calling CommitEdit even when Cancel parameter should be True.
    Or calling CancelEdit inside ValidateEdit when the Cancel parameter is True to just discard the changes and not to keep in edit mode.
    Also to note is that EditQueryClose event will not be called in case of LostFocus.

    Sample usage included in the demo project. (UserEditingForm.frm)
    Last edited by Krool; Apr 13th, 2019 at 04:19 PM.

  12. #252
    Hyperactive Member
    Join Date
    Jul 2013
    Posts
    372

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Are you sure that the keys Home and End should end the edit mode?
    I don't know if it's the standard behavior but seems strange to me. Imo these keys should put the cursor in the start/end of the text.

    Just my 0.02
    Carlos

  13. #253

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Carlos Rocha View Post
    Are you sure that the keys Home and End should end the edit mode?
    I don't know if it's the standard behavior but seems strange to me. Imo these keys should put the cursor in the start/end of the text.

    Just my 0.02€
    That is the case. Only when the caret is on specific position it will end edit mode.
    If needed it can be prohibited in EditQueryClose event.

  14. #254
    Hyperactive Member
    Join Date
    Jul 2013
    Posts
    372

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    That is the case. Only when the caret is on specific position it will end edit mode.
    If needed it can be prohibited in EditQueryClose event.
    Perfect, thank you
    Carlos

  15. #255
    Addicted Member
    Join Date
    Aug 2016
    Posts
    169

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    I suggest using pure Owner-Draw usercontrol instead of using CreateWindowEx from VBFlexGridWndClass. We know you have all technoques and skiils to do so.
    IMO,I hate mouse moving scrollbar but not updating Grid.

  16. #256

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by DaveDavis View Post
    I suggest using pure Owner-Draw usercontrol instead of using CreateWindowEx from VBFlexGridWndClass. We know you have all technoques and skiils to do so.
    IMO,I hate mouse moving scrollbar but not updating Grid.
    The problem is that UserControl is an ANSI window so user input chars are not unicode.
    For mouse moving scrollbar and not updating grid. What you mean? Doesn't ScrollTrack property set to True resolve this?

  17. #257
    Addicted Member
    Join Date
    Aug 2016
    Posts
    169

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    The problem is that UserControl is an ANSI window so user input chars are not unicode.
    Input Chars is done by your TextBoxW which is unicode.
    Quote Originally Posted by Krool View Post
    For mouse moving scrollbar and not updating grid. What you mean? Doesn't ScrollTrack property set to True resolve this?
    oops, I ignored this property. But the scrollbar has strange behavior. I tested in UserEditingForm. It's very obvious, you can reproduce.

  18. #258

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by DaveDavis View Post
    Input Chars is done by your TextBoxW which is unicode.
    The grid itself also receives input chars, even if there is no default processing. you could catch KeyPress with unicode chars to make your own incremental search or whatever. (As example)

  19. #259

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Edit: or bigger example. The grid receives first input char to start editing and forwards the first char to the TextBox. If the grid window is not unicode this would be not possible to enter first char as unicode

  20. #260
    Addicted Member
    Join Date
    Aug 2016
    Posts
    169

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    Edit: or bigger example. The grid receives first input char to start editing and forwards the first char to the TextBox. If the grid window is not unicode this would be not possible to enter first char as unicode
    We can subclass IME as olaf did.

  21. #261
    Frenzied Member
    Join Date
    Sep 2012
    Posts
    1,598

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    Update released. Now the in-cell editing functionality is finally implemented.

    The new AllowUserEditing property determines if the start of the edit is handled automatically.
    It will then be start automatically when:
    - F2 key
    - Space key
    - Keystroke/typing
    - Double click

    It can also be started by code using the StartEdit method, even if AllowUserEditing is False.

    The edit will end when:
    - Losing focus
    - Escape key
    - Return key
    - Tab/ShifTab key (meaningful only when TabBehavior <> Controls; otherwise it's just a LostFocus)
    - Navigation key (four Arrow keys, PageUp, PageDown, Home and End keys)

    The edit can also be ended by code using the CancelEdit or CommitEdit method.
    CancelEdit discard the changes whereas CommitEdit saves the changes.

    There are several read-only run-time properties:
    - hWndEdit As Long
    - EditRow As Long
    - EditCol As Long
    - EditReason As FlexEditReasonConstants
    - EditCloseMode As FlexEditCloseModeConstants

    And following run-time properties which are not read-only:
    - EditText As String
    - EditMaxLength As Long
    - EditSelStart As Long
    - EditSelLength As Long
    - EditSelText As String

    The chart below will illustrate the flow of the various events:

    Name:  FlexEditEventsFlowChart.png
Views: 302
Size:  17.4 KB

    To note is that when invoking by code the CommitEdit event that the ValidateEdit event is still triggered.
    Inside ValidateEdit you can force validation by again calling CommitEdit even when Cancel parameter should be True.
    Or calling CancelEdit inside ValidateEdit when the Cancel parameter is True to just discard the changes and not to keep in edit mode.
    Also to note is that EditQueryClose event will not be called in case of LostFocus.

    Sample usage included in the demo project. (UserEditingForm.frm)
    I quickly tested the cell editing functionality, which is a good start.

    (1) The characters position change (offset to the left) after entering the edit mode.
    (2) Maybe you could add a property EditPermanent to make the grid always in the edit state.
    (3) In addition, when the cell editing functionality is added, you should probably allow users to control the movement of the edit-box via vbKeyReturn and vbKeyTab or other keys.
    Last edited by dreammanor; Apr 15th, 2019 at 03:02 AM.

  22. #262

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by DaveDavis View Post
    But the scrollbar has strange behavior. I tested in UserEditingForm. It's very obvious, you can reproduce.
    I see. I didn't notice this on Windows 7 as there the scrolling is done on the focused window, whereas on Windows 10 the scrolling is done under the window from the mouse pointer.
    I will fix this asap.

    Regarding the grid window. I don't see the issue with VBFlexGridWndClass. At least then I have full control of everything. Just my opinion.

  23. #263

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Update released.

    Quote Originally Posted by DaveDavis View Post
    But the scrollbar has strange behavior. I tested in UserEditingForm. It's very obvious, you can reproduce.
    That's now fixed. The edit window position/size is now updated when scrolling while in edit mode.



    Quote Originally Posted by dreammanor View Post
    (1) The characters position change (offset to the left) after entering the edit mode.
    Should be doable to adjust this little offsets with EM_SETMARGINS. I will take a look soon.

    Quote Originally Posted by dreammanor View Post
    (2) Maybe you could add a property EditPermanent to make the grid always in the edit state.
    You could handle EnterCell or RowColChange event to manually call .StartEdit.

    Quote Originally Posted by dreammanor View Post
    (3) In addition, when the cell editing functionality is added, you should probably allow users to control the movement of the edit-box via vbKeyReturn and vbKeyTab or other keys.
    I didn't get it. Please explain again.
    The enter key will end edit mode, except when using shift, ctrl or alt key while pressing enter key. Doing so will insert a line break. Do you mean that?

  24. #264
    Addicted Member
    Join Date
    Aug 2016
    Posts
    169

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    That's now fixed. The edit window position/size is now updated when scrolling while in edit mode.
    Scrollbar still has problem which is hard to describe. In UserEditngForm, You can reproduce by clicking middle of VScrollbar (.ScrollTrack = True), thumb jumps to bottom. Look like Thumb size is too small as usual meanings the scrollbar algorithm is different with C# GridView control.
    Last edited by DaveDavis; Apr 15th, 2019 at 09:02 PM.

  25. #265
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    191

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    I tested and found that in windows server 2012 and windows 2017 system, mouse scrolling is invalid after entering edit mode.

    Name:  bug.jpg
Views: 284
Size:  54.7 KB
    QQ: 289778005

  26. #266
    Frenzied Member
    Join Date
    Sep 2012
    Posts
    1,598

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    I didn't get it. Please explain again.
    The enter key will end edit mode, except when using shift, ctrl or alt key while pressing enter key. Doing so will insert a line break. Do you mean that?
    When in the Editing-Permanent state, pressing the Return or Tab key will move the active editing cell to the next column of the current row, or the next row of the current column.

  27. #267

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by ChenLin View Post
    I tested and found that in windows server 2012 and windows 2017 system, mouse scrolling is invalid after entering edit mode.

    Name:  bug.jpg
Views: 284
Size:  54.7 KB
    What you mean with invalid? You can't scroll with left button clicks on scrollbar?
    For mousewheel for example in some windows version it's scrolling focused window vs. on other the windows version it's scrolling the window under the pointer.(WindowFromPoint so to say)

    Quote Originally Posted by dreammanor View Post
    When in the Editing-Permanent state, pressing the Return or Tab key will move the active editing cell to the next column of the current row, or the next row of the current column.
    When the TabBehavior property is <> Controls you could replicate the editing permament manually.
    However, there is no ReturnBehavior and WantReturn property yet. If that would be there you could build your own editing permanent style by code.
    Last edited by Krool; Apr 16th, 2019 at 11:45 PM.

  28. #268

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by dreammanor View Post
    (1) The characters position change (offset to the left) after entering the edit mode.
    That cosmetic issue is now resolved by internally using EM_SETMARGINS upon edit window creation. Thanks.

  29. #269

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by dreammanor View Post
    FlexSelectionModeByRowExtended Or FlexSelectionModeByRowEx

    FlexSelectionModeByColumnExtended Or FlexSelectionModeByColumnEx
    I'm still hesitating to just add enums for SelectionMode. Maybe I want to add other modes later on like in vsFlexGrid. (ListBox style selection etc.)

    Therefore I suggest to add another property called 'SelectionUnit'.
    Code:
    Public Enum FlexSelectionUnitConstants
    FlexSelectionUnitCell = 0
    FlexSelectionUnitFullRow = 1
    FlexSelectionUnitFullColumn = 2
    End Enum
    
    Returns/sets a value indicating which type of unit is used for selections in the flex grid.
    So FlexSelectionUnitCell would mean that the selection is really based on the range of .Row/.Col and .RowSel/.ColSel

    Whereas FlexSelectionUnitFullRow/FlexSelectionUnitFullColumn would mean to extend the selection to full rows/columns regardless of .RowSel/.ColSel.
    Only .Row/.Col would be taken into account for "displaying" (drawing) full selection on row/column.
    .RowSel/.ColSel can still be used; but are controlled then by SelectionMode.

    What do you think?

    Example:
    - Having .SelectionMode set to 'Free' and .SelectionUnit to 'FullRow'
    - .Rows is 100 and .Cols is 100
    - .Row is 1 and .RowSel is 2
    - .Col is 1 and .ColSel is 2
    -> Two full row selection would be drawn even if Col and ColSel are not spanning the whole set of columns. (100)
    Last edited by Krool; Apr 25th, 2019 at 03:17 PM.

  30. #270
    Frenzied Member
    Join Date
    Sep 2012
    Posts
    1,598

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    If you add the OperationMode property, things are easily solved:

    Code:
    Enum SelectBlockOptionsConstants
        SelectBlockOptionsNone = 0
        SelectBlockOptionsColumns = 1
        SelectBlockOptionsRows = 2
        SelectBlockOptionsBlocks = 4
        SelectBlockOptionsSheet = 8
        SelectBlockOptionsAll = 15
    End Enum
    
    Enum OperationModeConstants
        OperationModeNormal = 0
        OperationModeRead = 1
        OperationModeRow = 2
        OperationModeSingle = 3
        OperationModeMulti = 4
        OperationModeExtended = 5
    End Enum

  31. #271

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    The next OCX version is still not released..
    So I took the chance to change the 'interface' of the BeforeEdit event. The Row/Col params are now ByRef instead of ByVal.
    This gives an app more flexibility, if necessary. Or in other words, maybe an unecessary limitation was just removed.

  32. #272
    Hyperactive Member
    Join Date
    Apr 2015
    Posts
    442

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    I have found something.

    In the Demo project set AllowBigSelection = False, and set AllowSelection = False in the IDE.
    Start the project.
    Scroll down the grid by mouse wheel.

    Place the mouse on the fixed row.
    Press and hold the left button.

    The grid begins to scroll.
    I can't imagine that is intended.
    Or?

  33. #273

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Karl77 View Post
    I have found something.

    In the Demo project set AllowBigSelection = False, and set AllowSelection = False in the IDE.
    Start the project.
    Scroll down the grid by mouse wheel.

    Place the mouse on the fixed row.
    Press and hold the left button.

    The grid begins to scroll.
    I can't imagine that is intended.
    Or?
    That's intended.
    However, you can change with following code block the behavior which I think you want to have:
    Code:
    Private Sub VBFlexGrid1_BeforeMouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single, Cancel As Boolean)
    With VBFlexGrid1
    .HitTest X, Y
    If .HitResult = FlexHitResultCell Then
        If .HitCol > (.FixedCols - 1) And .HitRow < .FixedRows Then
            .Row = .TopRow
            .Col = .HitCol
            Cancel = True
        End If
    End If
    End With
    End Sub

  34. #274

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Update released.

    Added enum FlexSelectionModeFreeByRow and FlexSelectionModeFreeByColumn in the SelectionMode property.
    It's like a mix between FlexSelectionModeFree and FlexSelectionModeByRow or FlexSelectionModeByColumn.

  35. #275
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    191

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    How to easily achieve multiple choices? For example, drag the mouse to select the row, press CTRL to select the row that is not continuous, and press SHIFT to select the continuous row.
    And can get which rows are selected.
    QQ: 289778005

  36. #276

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by ChenLin View Post
    How to easily achieve multiple choices? For example, drag the mouse to select the row, press CTRL to select the row that is not continuous, and press SHIFT to select the continuous row.
    And can get which rows are selected.
    The vsFlexGrid has a 'ListBox' style selection mode. Which is like 'ByRow' but supports multiselection. Selected rows can be retrieved via an .RowSelected property.
    I might include something similar in future.

  37. #277

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Update released.

    Internal restructuring for drawing. The average performance boost in my tests were about 20%.

    The 1.2 OCX will not be updated by this restructuring, because soon the new 1.3 version will be anyway released.

  38. #278
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    191

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Hi Krool:

    If you press the following settings after the update, it will not display properly:
    VBFlexGrid1.FixedCols = 0
    VBFlexGrid1.MergeCells = FlexMergeCellsFree
    VBFlexGrid1.MergeCol(3) = True


    This means that VBFlexGrid1.FixedCols = 0 and VBFlexGrid1.MergeCells cannot be set at the same time. This is the latest version, and the previous version is still normal.


    Name:  无标题.jpg
Views: 139
Size:  20.1 KB
    Last edited by ChenLin; May 9th, 2019 at 03:41 AM.
    QQ: 289778005

  39. #279

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by ChenLin View Post
    Hi Krool:

    If you press the following settings after the update, it will not display properly:
    VBFlexGrid1.FixedCols = 0
    VBFlexGrid1.MergeCells = FlexMergeCellsFree
    VBFlexGrid1.MergeCol(3) = True


    This means that VBFlexGrid1.FixedCols = 0 and VBFlexGrid1.MergeCells cannot be set at the same time. This is the latest version, and the previous version is still normal.


    Name:  无标题.jpg
Views: 139
Size:  20.1 KB
    Thanks for reporting. It's kinda normal that after a restructuring new bugs appear.
    Update released. Now it should be all fine.

  40. #280

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

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Update released.

    Included the EditDropDownList run-time property to enrich the in-cell editing functionality.

    The EditDropDownList may be set at the BeforeEdit event, either to vbNullstring (default; off) or to a string each item separated by pipe characters. ("|")
    It works similar to the ComboList Property of the vsFlexGrid.
    However, I don't use the ComboBox class. I rely on the edit window and extended the combo functionality as can be seen at following screen:
    Name:  FlexEditDropDownList.png
Views: 111
Size:  10.7 KB

    So everything works as normal with just some additional windows. The dropdown button is a Static control with SS_OWNERDRAW and SS_NOTIFY which can't get focus. So the edit window will not get destroyed by a lost focus.
    The actual dropdown window is a ComboLBox class window with WS_POPUP style. It also don't receive focus and can't be activated, it just "captures" the mouse and key inputs.

    Depending on how the EditDropDownList property is set it imitates a "Dropdown Combo" or "Dropdown List" style ComboBox.
    "Dropdown List": (Edit window with ES_READONLY; DroppedDown immediately)
    Code:
    EditDropDownList = "ListItem 1|ListItem 2"
    "Dropdown Combo": (Edit window unchanged; certain behavior adjustments)
    Code:
    EditDropDownList = "|ListItem 1|ListItem 2"
    The additional EditDroppedDown run-time property can programmatically expand or collapse the dropdown list by code. In normal cases not needed.
    Last edited by Krool; May 13th, 2019 at 05:15 PM.

Page 7 of 9 FirstFirst ... 456789 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
  •  



Featured


Click Here to Expand Forum to Full Width