-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi Krool,
I meant to ask this before, forgot, but your message reminded me:
Is it possible to display a vertical scrollbar permanently, even if the number of rows wouldn't require one? I like the columns to fill the width of the grid nicely, so that there is no "unused space" on the right, but it's always a pain to deal with resizing them depending on whether a vertical scrollbar is displayed or not.
Thanks,
Erwin
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Erwin69
Hi Krool,
I meant to ask this before, forgot, but your message reminded me:
Is it possible to display a vertical scrollbar permanently, even if the number of rows wouldn't require one? I like the columns to fill the width of the grid nicely, so that there is no "unused space" on the right, but it's always a pain to deal with resizing them depending on whether a vertical scrollbar is displayed or not.
Thanks,
Erwin
Did you consider the ExtendLastCol property?
And/Or the DisableNoScroll property?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Did you consider the ExtendLastCol property?
And/Or the DisableNoScroll property?
Learning every day! :bigyello: DisableNoScroll will do the trick.
Didn't find the ExtendLastCol, has it been added after release 1.4?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Uh.. a LOT of good changes since 1.4 xD
Just update it, speed, new features... buf..
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi,
FASTEST WAY TO MOVE A SET OF DATA INTO A GRID
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?
Thanks,
Erwin
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Exactly the same way, with the .getrows feature
Sorry, i read too fast, the .getrows is working to fill de grid, about the export feature ... i will wait for Krool answer xD
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Erwin69
Hi,
FASTEST WAY TO MOVE A SET OF DATA INTO A GRID
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?
Thanks,
Erwin
The fastest way is to not move the data into grid.
Just use .GetRows of your db and use .FlexDataSource to feed the grid from your .GetRows array per-demand for the current viewport.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Thanks for the quick reply, but I wonder if that is the best approach given the specific situation I'm dealing with.
I didn't want to make the original question too complex/large, but maybe I should have added some additional info.
The process is as follows:
1. The user selects some options
2. Based on those the data is retrieved from the database (normally < 1000 records, usually even < 300)
3. The user then applies "actions" to the grid (think popup menu or double click cells to mark them)
4. Cell contents change based on the action that is applied.
Once done, all rows that require and action are "batch processed".
Actions are not done on the records that were originally retrieved. As a generic example, that should be easier to understand than the industry specific thing I'm working on, think of retrieving a list of tasks that then are assigned to different people. Tasks in rows, people in columns. Double clicking the cell where the column and row crosses, changes its contents in a + when a task is assigned, or a - when it's taken away from the person. In the batch processing, an email is created for each person with the assigned tasks.
Knowing this, do you still feel that using the FlexDataSource is the best way to go?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
How do you currently feed the grid? 1000 rows shouldbe feeded instantly with just setting .TextMatrix with 2 loops..
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
How do you currently feed the grid? 1000 rows shouldbe feeded instantly with just setting .TextMatrix with 2 loops..
I currently use two nested For...Next loops to cycle through rows and columns, and assign values to each cell. I figured that there would be something as TextMatrix that would help making that easier / quicker, but couldn't find an example of it.
(You may have seen a similar question in the Common Controls Replacement thread related to the ListView control. In that case we're more often dealing with larger numbers of records, where the listview is more used as an step in between the database and an Excel sheet. While I was at it, I thought to ask the question here as well as part of learning new things, and potentially reconsidering which control to use for what.)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi all, is there any way to remember the last active cell ?
(not so easy xD) i mean: i have a MDI program, VBflexgrid is on one Form, i open the form and fill the grid, i select row 4 and column 6, not for edit, just select it.
I change to another program, firefox, for example, and then when i return to my program, R4-C6 is not selected.
I tried to save the row / col in form_lostfocus in 2 variables, and return them in form_getfocus but it's not working...
Any idea ?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Calcu
Hi all, is there any way to remember the last active cell ?
(not so easy xD) i mean: i have a MDI program, VBflexgrid is on one Form, i open the form and fill the grid, i select row 4 and column 6, not for edit, just select it.
I change to another program, firefox, for example, and then when i return to my program, R4-C6 is not selected.
I tried to save the row / col in form_lostfocus in 2 variables, and return them in form_getfocus but it's not working...
Any idea ?
Normally the grid does not change the Row/Col (focus rect)
Do you have a demo showing the issue ? I cannot follow to be honest.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
Included the CellTag property which holds a variant to store any extra data.
The variant is allocated only when needed to keep memory usage low.
Included enum FlexClearTag for the .Clear method and included enum FlexCellTag for the .Cell property.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
I noticed that the number of rows has to be larger than the number of fixed rows when setting this through the properties in the IDE. However, it is no problem to change the number of rows to be equal to the number of fixed rows through code.
The same question applies to columns.
My approach is often to show the user an empty grid with only the header row, which then will be expanded with additional columns depending on selections.
Is there a reason for this, or is it a bug? Or maybe this is fixed in a newer release than the 1.4 OCX I'm currently using?
It's not a big thing, as it's easy to workaround in code, but I was just wondering.
Regards,
Erwin
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Erwin69
I noticed that the number of rows has to be larger than the number of fixed rows when setting this through the properties in the IDE. However, it is no problem to change the number of rows to be equal to the number of fixed rows through code.
The same question applies to columns.
My approach is often to show the user an empty grid with only the header row, which then will be expanded with additional columns depending on selections.
Is there a reason for this, or is it a bug? Or maybe this is fixed in a newer release than the 1.4 OCX I'm currently using?
It's not a big thing, as it's easy to workaround in code, but I was just wondering.
The property page does not allow this, correct. As there all properties will be set. However, you can also set the Rows equal to FixedRows in the IDE. Just use the property pane and not the property page.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
Included the ColImageList As Variant property. (like in vsFlexGrid)
Either an ImageList object or an hImageList handle can be set. (vsFlexGrid allows only handle)
Numeric text will be treated as an image index. (both, object or handle)
Otherwise it will be tried to access the image index by it's key. (object only)
The image alignment is based on the text alignment. (CellAlignment/ColAlignment/FixedAlignment)
The cell text will become hidden if an image got drawn.
Included the CellImageCallback event where the app can provide the image value.
The Handled parameter must be set to True to overwrite the default behavior.
It enables also a way to ensure that no image will be tried to retrieve for certain cells. (e.g. for fixed rows)
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
Quote:
Originally Posted by
softv
I have 3 columns in a grid. The 2nd column has checkboxes. The columns are resizable. If I resize all the columns to near-zero width, then the checkboxes alone show up at the end of all the shrunk columns. If my observation is not right, then kindly let me know what one has to do so that the checkboxes do not get displayed.
Ok, I could now replicate this issue.... checking on the last column brought this up.
It's now fixed. Thanks.
Attachment 189035
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Included the overdue OLEDragDropScroll property. (default to True)
The 1.6 OCX got this feature included (as defaulting to True anyway) but w/o property..
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
Included the DropHighlight/DropHighlightMode run-time property.
The demo project got updated to use OLEDragDrop (instead of the "old" DragDrop) for the 'DragRow' demonstration.
Due to OLEDragDropScroll the VBFlexGrid can now scroll while dragging the row.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
Included the InsertMark/InsertMarkMode run-time property.
Included the HitTestInsertMark function.
The demo project got updated to demonstrate the insertion mark feature.
-
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
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
SamOscarBrown
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.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Erwin69
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
-
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. ;)
-
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?
-
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 :-)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Calcu
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.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
but only a button, no a combo with button
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Calcu
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.
-
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
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Calcu
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.
-
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?
-
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.
-
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
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
vb6nostalgia
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.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
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
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
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.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
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.
-
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!
-
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
-
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
-
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.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Appreciate your continued work on this grid, Thank you.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
OCX version 1.7 released.
-
1 Attachment(s)
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! Attachment 189706
-
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
-
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.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
PietroV
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
-
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
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
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.
-
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
-
1 Attachment(s)
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.
Attachment 189838
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
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.
-
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 !
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
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?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
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
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
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.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
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
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Calcu
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.
Attachment 190111
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
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
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
...and do below helper ? (this would solve to bother about BeforeCut)
Yes, it should work.
-
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.