Page 30 of 32 FirstFirst ... 20272829303132 LastLast
Results 1,161 to 1,200 of 1279

Thread: VBFlexGrid Control (Replacement of the MSFlexGrid control)

  1. #1161
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,060

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Was looking through this thread, but couldn't find an answer to my question, which is, Is there an auto-column-width function built in that would automatically set the columns' width to the longest string in those columns. I have used the MSFlexgrids for quite a while, and your vbFlexGrid for quite a few months now. I could not find such an enhancement in either. I have always set the column width 'by hand' when setting up a grid...

    just wondering

    Sammi
    Sam I am (as well as Confused at times).

  2. #1162

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,359

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by SamOscarBrown View Post
    Was looking through this thread, but couldn't find an answer to my question, which is, Is there an auto-column-width function built in that would automatically set the columns' width to the longest string in those columns. I have used the MSFlexgrids for quite a while, and your vbFlexGrid for quite a few months now. I could not find such an enhancement in either. I have always set the column width 'by hand' when setting up a grid...

    just wondering

    Sammi
    .AutoSize method.

  3. #1163

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,359

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Erwin69 View Post
    When working with sets of data, there is for example the Recordset.GetRows feature to quickly move all data retrieved from a database into an array. For exporting to Excel there is the Range.Resize function to quickly move the data from an array into a worksheet.

    I guess the VBFlexGrid control offers such features as well, but haven't figured it out yet. If it indeed does, can you give me some pointers on how to do that?
    Update released.

    Included the CopyFromRecordset function which copies the contents of an ADO or DAO Recordset onto the flex grid.
    It works like the Excel function which returns the number of fetched records and copies from the current position to EOF.
    The number of maximum rows and columns can be specified.
    If omitted it is maximum remaining rows and columns that the grid can receive relative to the destination starting point.
    The grid will not grow and it just ignores the overflow of rows and columns. (like Excel)
    The destination row/col can be specified where the pasting onto the flex grid starts.
    If omitted it is the first non-fixed row and first non-fixed column.

    VBFlexGrid
    Public Function CopyFromRecordset(Data As Object, [ByVal Rows As Long = -1], [ByVal Cols As Long = -1], [ByVal Row As Long = -1], [ByVal Col As Long = -1]) As Long

    Excel
    Function CopyFromRecordset(Data As Unknown, [MaxRows], [MaxColumns]) As Long

  4. #1164

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,359

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Update released.

    Edge case bugfix in the CopyFromRecordset function and minor tweaks. So, it's now hardened on DAO and ADO recordsets.

  5. #1165
    New Member
    Join Date
    Oct 2023
    Posts
    9

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Hello, first of all thank you for the good work with the VBFlexgrid control. Lately I have changed from a grid control to vbflexgrid, I am trying to use the "Standard EXE Version" however when I am debugging VB6 it closes without giving any error. This is happening to me after switching from using the OCX version to the "EXE" version.
    I also have a question about how to make the grid work, let's say I have 5 columns, in three of them the user must enter a sku and the name of the item appears in column 2 and in column 3 they must enter a price, and then jump to the next line in column 1, with BeforeEdit I can prevent the user from entering information in that column, but how can I make sure that the columns that are read-only do not accept the focus?

  6. #1166
    Lively Member
    Join Date
    May 2022
    Posts
    76

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Hi!

    Everything seems to be fine :-), thanks a lot.

    My question is:

    Could you add the possibility of having a button inside the cell ?, i can do it with a picture, etc..., but just to be like the combo and the checkbox, that you implemented it into the grid and is working so fine :-)

  7. #1167

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,359

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Calcu View Post
    Hi!

    Everything seems to be fine :-), thanks a lot.

    My question is:

    Could you add the possibility of having a button inside the cell ?, i can do it with a picture, etc..., but just to be like the combo and the checkbox, that you implemented it into the grid and is working so fine :-)
    There is already combo button (or combo cue button) available.
    You can set a picture inside that button.

  8. #1168
    Lively Member
    Join Date
    May 2022
    Posts
    76

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    but only a button, no a combo with button

  9. #1169

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,359

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Calcu View Post
    but only a button, no a combo with button
    Just use a combo cue with button.
    Evaluate BeforeEdit event. When Reason <> ComboCue then cancel. Otherwise cancel as well but execute your button click handler routine.

  10. #1170
    Lively Member
    Join Date
    May 2022
    Posts
    76

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    But doing this way, i can't change the 3 dots inside the button with a text, for example

  11. #1171

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,359

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Calcu View Post
    But doing this way, i can't change the 3 dots inside the button with a text, for example
    You can set a button picture. See ColComboButtonPicture or ComboButtonPicture.
    Worst case set ComboButtonDrawMode to owner draw.

  12. #1172
    New Member
    Join Date
    Oct 2023
    Posts
    9

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Hi!
    I have a question.
    Is there a way to define a column that cannot receive focus and also ignore those columns when the user moves with the keyboard from one column to another.
    Something similar to how a "fixed column" works but not at the beginning, but between columns.

    It turns out that I have tried to have certain columns disabled within the grid,
    but so far I have not been able to.
    Will there be a way to do it?

  13. #1173
    Lively Member
    Join Date
    May 2022
    Posts
    76

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Do you need to not receive focus or it's enough to block the column to not edit it ?

    To block it, in the cellbeforeEdit event you can use:

    Code:
    if col = 3 then
        cancel = true
        grid.col=4   ' you can send the focus to any col .
    end if
    For example.

  14. #1174
    New Member
    Join Date
    Oct 2023
    Posts
    9

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Thanks!
    what I need is to not receive focus.

    example: On press enter or right arrow key move to next col enabled
    Attachment 189242

  15. #1175

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,359

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by vb6nostalgia View Post
    Thanks!
    what I need is to not receive focus.

    example: On press enter or right arrow key move to next col enabled
    Attachment 189242
    Try the BeforeRowColChange event. That's for the caret.
    There are also BeforeSelChange event.

  16. #1176
    New Member
    Join Date
    Oct 2023
    Posts
    9

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    Try the BeforeRowColChange event. That's for the caret.
    There are also BeforeSelChange event.
    thank you! I had only tried Before RowColChange, with your indication I understood better how to implement that operation.

    that did the job.

    Code:
    Private Sub table1_BeforeRowColChange(ByVal NewRow As Long, ByVal NewCol As Long, Cancel As Boolean)
       If NewCol = 2 Then
          Cancel = True
          table1.Col = 3
       End If
    End Sub
    
    Private Sub table1_BeforeSelChange(ByVal NewRowSel As Long, ByVal NewColSel As Long, Cancel As Boolean)
       If NewColSel = 2 Then
          Cancel = True
       End If
    End Sub

  17. #1177
    Addicted Member
    Join Date
    Apr 2017
    Location
    India
    Posts
    218

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    Update released.



    Ok, I could now replicate this issue.... checking on the last column brought this up.
    It's now fixed. Thanks.

    Attachment 189035
    Thanks a TON, krool. How great of you to remember even such a small request of mine and give a fix. Always in gratitude.

    Have not been able to find focused time to get into this thread for the past few weeks. Hence, the delay in acknowledging.

    Have a Divineful Day!

    Kind Regards.

  18. #1178
    Addicted Member
    Join Date
    Apr 2017
    Location
    India
    Posts
    218

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    Update released.

    Included the CopyFromRecordset function which copies the contents of an ADO or DAO Recordset onto the flex grid.
    It works like the Excel function which returns the number of fetched records and copies from the current position to EOF.
    The number of maximum rows and columns can be specified.
    If omitted it is maximum remaining rows and columns that the grid can receive relative to the destination starting point.
    The grid will not grow and it just ignores the overflow of rows and columns. (like Excel)
    The destination row/col can be specified where the pasting onto the flex grid starts.
    If omitted it is the first non-fixed row and first non-fixed column.

    VBFlexGrid
    Public Function CopyFromRecordset(Data As Object, [ByVal Rows As Long = -1], [ByVal Cols As Long = -1], [ByVal Row As Long = -1], [ByVal Col As Long = -1]) As Long

    Excel
    Function CopyFromRecordset(Data As Unknown, [MaxRows], [MaxColumns]) As Long
    Great, krool. Some weeks back, when I needed this requirement, I stumbled upon our great Olaf's solution (cFlexSQLiteDS) here - https://www.vbforums.com/showthread....=1#post5514140 - it was very much for (y)our fabulous VBFlexGrid only. Olaf's readymade solution worked like a charm, as always. Its great now to see this functionality inbuilt in VBFlexGrid itself. I am yet to get time to download the latest VBFlexGrid and see what methodology you have adopted, to accomplish this 'CopyFromRecordSet' functionaltiy. The features you have specified for the CopyFromRecordSet function look wonderful. Thanks a TON. Looking forward to avail them soon, some time in the coming days.

    Always remaining in gratitude to the wisdom of you, Olaf, LaVolpe, et al.

    Kind Regards.

  19. #1179
    Lively Member
    Join Date
    May 2022
    Posts
    76

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Hi all, a new question (is not a problem with the grid itself), it's only to know the best way to do it.

    I have a grid with .... 200 lines

    I want to "auto select" 50 of them, via clipboard. I mean, i have a list with this 50 items to search at the grid, find and select them.

    Actually i'm pasting the list on another grid and with a loop searching for the items on the first grid.

    Is there any way to just drag a file (a txt with the items, one on each line) for example and select this? what event must i use fot this ?

    Thanks !!!

    For any who searchs something similar:

    Event: BeforeClipboardAction

    Code:
    If Action = FlexClipboardActionPaste Then
    Tcop = Clipboard.GetText  
    
    'do what you need 
    
    Cancel = True
    end If

    it's perfect.

    thanks!
    Last edited by Calcu; Nov 22nd, 2023 at 04:07 AM.

  20. #1180
    Lively Member
    Join Date
    May 2022
    Posts
    76

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    @Krool do you think it's possible to make groups in vbflexgrid ?

    Like this in excel :

    (edit: trying to upload a gif in movement)

    https://imgur.com/BGursmZ
    Last edited by Calcu; Nov 26th, 2023 at 02:33 PM.

  21. #1181

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,359

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Update released.

    Fixed that no invalidation occurs when setting Rows/Cols to 0. (regression 13-Nov-2023)

    Included the ClearRowInfo/ClearColInfo method which clears the info structure for the specified row/column.
    An index of -1 will clear the info structure for all rows/columns.

    Below code example will reset everything. Thus in some special situations it would not be necessary anymore to set rows/cols to 0 and back to the original value.
    Code:
    VBFlexGrid1.Clear FlexClearEverywhere, FlexClearEverything
    VBFlexGrid1.ClearRowInfo -1
    VBFlexGrid1.ClearColInfo -1
    Last edited by Krool; Dec 9th, 2023 at 04:32 PM.

  22. #1182

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,359

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Update released.

    Included the ColCheckBoxesHitTestInvisible/ColCheckBoxesHitTestInvisibleFixed run-time property.

    It determines whether check boxes are visible but not hit-testable. (cannot interact with mouse cursor)

    This can be useful for representation only check boxes (e.g. FlexTextAsCheckBox) where hot-light is not needed and CellClick (etc.) events should fire.
    However, this does not avoid changing the checked state by space key.
    To avoid that use the FlexDisabled* checked states or set Cancel = True on the CellBeforeCheck event.

    EDIT: Included Optional ByRef DisabledOnly As Boolean parameter in these ColCheckBoxesHitTestInvisible/ColCheckBoxesHitTestInvisibleFixed property.
    When set to True and DisabledOnly is also True the effect is that only disabled check boxes are not hit-testable.
    When set to False and DisabledOnly is True the effect is inversed and only enabled check boxes are not hit-testable.

    The simple mode is of course when set to True (ignore DisabledOnly) all check boxes are not hit-testable.
    When set to False all check boxes are hit-testable.
    Last edited by Krool; Dec 12th, 2023 at 12:33 PM.

  23. #1183
    Addicted Member
    Join Date
    Jul 2022
    Posts
    165

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Appreciate your continued work on this grid, Thank you.

  24. #1184

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,359

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    OCX version 1.7 released.

  25. #1185
    New Member
    Join Date
    Dec 2020
    Posts
    14

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Loving the control. Great work. One request: can you add (or is it possible to code a workaround) to add a cell border? We are hoping to use the control as an update to a very old grid control (Protoview DataTable) that was very capable as a data entry device (but has a look-and-feel rushing headlong into 1999). This is what we have and would like to do with FG. Thanks! Name:  CellWithBorder.PNG
Views: 367
Size:  1.1 KB

  26. #1186
    New Member
    Join Date
    Jun 2023
    Posts
    6

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Hello Krool,

    really thanks for this great control, I hope I can get rid of the MSHflexgrid.

    Today I was experimenting for the first time with your OCX 1.7 and stumbled upon a problem.
    I have a simple test app where I connect a MSHflexgrid to a recordset populated with data from a MySql DB which I connect through with MySql ODBC driver v5.1.

    I have one table that contains integer, datetime and varchar fields only, just a few dozens of records that works well with MSHFlegrid.
    The command:
    Code:
    MSHFlexGrid1.DataSource = rsCloud
    works without issues and populate the grid.

    If I repeat the same command with your grid with exactly the same table:
    Code:
    VBFlexGrid1.DataSource = rsCloud
    I got the following error:
    Attachment 189713

    Do you know what can be the problem ?
    Thanks in advance

  27. #1187
    Hyperactive Member
    Join Date
    Feb 2015
    Location
    Colorado USA
    Posts
    261

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    I have a utility/user guide for Krool's vbCCR and vbFlexGrid controls. In addition, it provides a mechanism that you can develop with the .OCX versions (faster & more stable in the IDE) but compiles the controls you actually use into your EXE (smaller and is totally self-contained; don't need to worry about SxS or including/registering the OCX files on your clients' PC's). It is here in VBForums.

  28. #1188
    New Member
    Join Date
    Jun 2023
    Posts
    6

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by PietroV View Post
    Hello Krool,

    really thanks for this great control, I hope I can get rid of the MSHflexgrid.

    Today I was experimenting for the first time with your OCX 1.7 and stumbled upon a problem.
    I have a simple test app where I connect a MSHflexgrid to a recordset populated with data from a MySql DB which I connect through with MySql ODBC driver v5.1.

    I have one table that contains integer, datetime and varchar fields only, just a few dozens of records that works well with MSHFlegrid.
    The command:
    Code:
    MSHFlexGrid1.DataSource = rsCloud
    works without issues and populate the grid.

    If I repeat the same command with your grid with exactly the same table:
    Code:
    VBFlexGrid1.DataSource = rsCloud
    I got the following error:
    Attachment 189713

    Do you know what can be the problem ?
    Thanks in advance
    Krool,
    I have debugged going through the source code of the OCX and noted that for some reason the problem is caused by a TinyInt field:
    although the ADODB recordset can handle the field correctly the ADODB Recordset.Getrows() function used to fill the ArrRows array fails to convert it correctly and create the problem.
    Converting the field to a smallint solved it.
    Thanks again for the great control.
    Pietro

  29. #1189
    New Member
    Join Date
    Jun 2023
    Posts
    6

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Hello MountainMan,
    thanks for the suggestion!
    I will study it and maybe, why not, I will use it.
    Really many thanks

    Pietro

  30. #1190
    Addicted Member
    Join Date
    Apr 2017
    Location
    India
    Posts
    218

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    Updated released.

    Included the CopyFromRecordset function which copies the contents of an ADO or DAO Recordset onto the flex grid.
    ... .. .
    ..
    .
    I heartily wish you a Very Happy New Year, Krool.

    Your controls are one of the most invaluable and most powerful ones, which all know. Thanks a TON, forever.

    And, the speed at which you are updating the FlexGrid control is mindboggling.

    I will write back here once I get time to check out all the recent enhancements you have effected.

    Have a Divineful Year!

    God Bless you. God Bless all.

    Kind Regards.
    Last edited by softv; Jan 3rd, 2024 at 08:23 AM.
    Love is God. God is Love. As Ever, All Glory and Thanks to the Lord Almighty Only, Forever...

    "You say grace before meals. All right. But I say grace before the concert and the opera, and grace before the play and pantomime, and grace before I open a book, and grace before sketching, painting, swimming, fencing, boxing, walking, playing, dancing and grace before I dip the pen in the ink." - G. K. Chesterton

  31. #1191

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,359

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Update relased.

    Included the AllowReaderMode property which enables the support of the reader-mode API for auto-scrolling and panning.

    The OCX VBFLXGRD17 was also updated. The internal type lib version is now 1.1.

    Code:
    Object={2DA70529-3366-414A-B408-46083BCD481B}#1.1#0; VBFLXGRD17.OCX

  32. #1192

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,359

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    ReaderMode shows now a half blended cursor image indicating the anchor position. (like in WordPad)
    It's working as of Windows XP.

    Name:  FlexReaderModeGlyph.png
Views: 207
Size:  6.9 KB
    Last edited by Krool; Jan 11th, 2024 at 07:00 PM.

  33. #1193
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    301

    Exclamation Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    28-Sep-2023
    - Included the BeforeClipboardAction/AfterClipboardAction event.
    Enum 'FlexClipboardActionConstants' included to distinguish between Copy, Cut, Paste and Delete.
    Hi, Krool!

    The BeforeClipboardAction event has empty Text parameter when the Delete action is performed. In my opinion it should contain "clean" values of deleted cells without headers (ClipCopyMode should be ignored). It would be useful for the Undo operation.

    Best regards,
    Nouyana.

    Code:
    Private Sub VBFlexGrid1_BeforeClipboardAction( _
                        ByVal Action As FlexClipboardActionConstants, _
                              Text As String, _
                              Cancel As Boolean)
       Debug.Print "========================"
       Select Case Action
       Case FlexClipboardActionDelete
          Debug.Print "Before Delete. Text:"
          Debug.Print Text                            ' Text is empty
       End Select
    End Sub
    Edited:

    In my opinion, if the Cut action is about to be performed, the BeforeClipboardAction event should be called twice: one for the Copy and another one for the Delete method. The Text parameter for the Copy method may contain headers (in accordance with ClipCopyMode), but not for the Delete method.
    Last edited by Nouyana; Jan 22nd, 2024 at 07:10 AM.

  34. #1194
    Lively Member
    Join Date
    May 2022
    Posts
    76

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Hi allĂ*, it's possible to move columns dragging and dropping them ?

    I will try to do it this afternoon, but.. I little help will be great xD.

    Thanks !

  35. #1195

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,359

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Nouyana View Post
    Hi, Krool!

    The BeforeClipboardAction event has empty Text parameter when the Delete action is performed. In my opinion it should contain "clean" values of deleted cells without headers (ClipCopyMode should be ignored). It would be useful for the Undo operation.

    Best regards,
    Nouyana.

    Code:
    Private Sub VBFlexGrid1_BeforeClipboardAction( _
                        ByVal Action As FlexClipboardActionConstants, _
                              Text As String, _
                              Cancel As Boolean)
       Debug.Print "========================"
       Select Case Action
       Case FlexClipboardActionDelete
          Debug.Print "Before Delete. Text:"
          Debug.Print Text                            ' Text is empty
       End Select
    End Sub
    Edited:

    In my opinion, if the Cut action is about to be performed, the BeforeClipboardAction event should be called twice: one for the Copy and another one for the Delete method. The Text parameter for the Copy method may contain headers (in accordance with ClipCopyMode), but not for the Delete method.
    Thanks for your valued input.
    I thought too about the Cut action. What in your opinion should be the Text for the Cut BeforeClipboardAction?
    So the Cut methold would fire first BeforeCut then BeforeCopy/AfterCopy, then BeforeDelete/AfterDelete and then finally AfterCut.

    To be on the same page. The Text for the BeforeDelete event should be the content text which is about to be deleted?

  36. #1196
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    301

    Arrow Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    So the Cut methold would fire first BeforeCut then BeforeCopy/AfterCopy, then BeforeDelete/AfterDelete and then finally AfterCut.
    You can't do it just like that if you worry about backward compatibility. Let's say that somebody already use it this way:

    Code:
    Private Sub VBFlexGrid1_BeforeClipboardAction( _
                    ByVal Action As FlexClipboardActionConstants, _
                          Text As String, Cancel As Boolean)
       Select Case Action
       Case FlexClipboardActionCopy, FlexClipboardActionCut
          ' Any conversion which could be performed twice:
          Text = Replace$(Text, "A", "AA")
          Text = "Header" & vbCr & Text & vbCr & "Footer"
       End Select
    End Sub
    If you will fire the BeforeCut and then BeforeCopy, it will cause a double conversion.

    Quote Originally Posted by Krool View Post
    What in your opinion should be the Text for the Cut BeforeClipboardAction?
    I see only two scenarios.

    1. You may just remove the BeforeCut event (the FlexClipboardActionCut constant) and replace it with BeforeCopy and BeforeDelete. Code like the above will work fine, but maybe another code will work wrong.

    2. You may add a property which will indicate a behavour: BeforeCut (default) or BeforeCopy+BeforeDelete.

    Anyway, the Text in the BeforeCopy or BeforeCut is Ok now.

    Quote Originally Posted by Krool View Post
    The Text for the BeforeDelete event should be the content text which is about to be deleted?
    Yes. The text should be such that we can simply save it in memory and, if necessary, return it back (UnDo / ReDo) with the Paste method.
    Last edited by Nouyana; Jan 22nd, 2024 at 02:05 PM.

  37. #1197

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,359

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Nouyana View Post
    You can't do it just like that if you worry about backward compatibility. Let's say that somebody already use it this way:

    Code:
    Private Sub VBFlexGrid1_BeforeClipboardAction( _
                    ByVal Action As FlexClipboardActionConstants, _
                          Text As String, Cancel As Boolean)
       Select Case Action
       Case FlexClipboardActionCopy, FlexClipboardActionCut
          ' Any conversion which could be performed twice:
          Text = Replace$(Text, "A", "AA")
          Text = "Header" & vbCr & Text & vbCr & "Footer"
       End Select
    End Sub
    If you will fire the BeforeCut and then BeforeCopy, it will cause a double conversion.



    I see only two scenarios.

    1. You may just remove the BeforeCut event (the FlexClipboardActionCut constant) and replace it with BeforeCopy and BeforeDelete. Code like the above will work fine, but maybe another code will work wrong.

    2. You may add a property which will indicate a behavour: BeforeCut (default) or BeforeCopy+BeforeDelete.

    Anyway, the Text in the BeforeCopy or BeforeCut is Ok now.



    Yes. The text should be such that we can simply save it in memory and, if necessary, return it back (UnDo / ReDo) with the Paste method.
    I see. I also found out that the .Delete method does not respect the ClipMode property (= ExcludeHidden).

    I keep the BeforeCut event like it is. Not overcomplicating things ...
    How about keeping the BeforeDelete event with empty Text and do below helper ? (this would solve to bother about BeforeCut)
    Code:
    Private Sub VBFlexGrid1_BeforeClipboardAction(ByVal Action As FlexClipboardActionConstants, Text As String, Cancel As Boolean)
    Select Case Action
        Case FlexClipboardActionDelete
            Dim OldClipCopyMode As FlexClipCopyModeConstants
            OldClipCopyMode = VBFlexGrid1.ClipCopyMode
            VBFlexGrid1.ClipCopyMode = FlexClipCopyModeNormal
            Text = VBFlexGrid1.Clip ' Text is already a free provided variable.
            VBFlexGrid1.ClipCopyMode = OldClipCopyMode
            ' Do the rest.
    End Select
    End Sub

  38. #1198

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,359

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Calcu View Post
    Hi allĂ*, it's possible to move columns dragging and dropping them ?

    I will try to do it this afternoon, but.. I little help will be great xD.

    Thanks !
    The demo project uses a move rows dragging and dropping example. I extended the demo to make the same for the columns.
    Just hit that button in the demo project to enable the functionality.
    Name:  FlexDragRowCol.png
Views: 112
Size:  3.0 KB

  39. #1199
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    301

    Arrow Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    I see. I also found out that the .Delete method does not respect the ClipMode property (= ExcludeHidden).
    If it will respect the ClipMode property, then the UnDo/ReDo functionality will be more complicated. In this case it will be better to implement undo and redo methods instead. Sounds great for me

    Quote Originally Posted by Krool View Post
    How about keeping the BeforeDelete event with empty Text ...?
    Why? You can at least make it the same as the others. It will be more obvious.

    Quote Originally Posted by Krool View Post
    ...and do below helper ? (this would solve to bother about BeforeCut)
    Yes, it should work.

  40. #1200

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,359

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Update relased.

    FlexClearText for the .Clear method can now be used even when a custom data source is set.

    Added FlexClearClip enum (clip range) which the .Delete method now uses instead of FlexClearSelection.

    Added FlexClipPasteModeExtended/FlexClipPasteModeExtendedAutoSelection enum.
    If ClipPasteMode is >= Extended then FlexClearClip deletes also the extended selection. (opposite action)

    The OCX VBFLXGRD17 was also updated. The internal type lib version is now 1.2.

    Code:
    Object={2DA70529-3366-414A-B408-46083BCD481B}#1.2#0; VBFLXGRD17.OCX
    EDIT: There is no behavior break to existing code except that .Delete respects now the ClipMode (= ExcludeHidden)
    But that I do consider as a bug fix.
    Last edited by Krool; Jan 23rd, 2024 at 01:43 PM.

Page 30 of 32 FirstFirst ... 20272829303132 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