-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
Krool, can you somehow explain me where is the ClientWidth/Height, NonClientWidth/Height and GridLineOffsets here?
The top gridline offset is now absent with the same code. I don't know why.
Krool, please help me to understand what do theese properties mean:
1. GetGridLineOffsets:
Left = 0
Top = 0 (I have no offset now, but I had 1px offset on my previous screenshot).
Right = 15 (1px)
Bottom = 15 (1px)
2. ComboButtonNonClientWidth and ComboButtonNonClientHeight = 90 (6px). Where are they? I see only two pixels on the right and two pixels on the left of the picture.
3. ComboButtonClientWidth = 195 (13px). My icon has 32px width. What is 13px?
https://www.vbforums.com/images/ieimages/2024/03/24.png
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
The top gridline offset is now absent with the same code. I don't know why.
Krool, please help me to understand what do theese properties mean:
1.
GetGridLineOffsets:
Left = 0
Top = 0 (I have no offset now, but I had 1px offset on my previous screenshot).
Right = 15 (1px)
Bottom = 15 (1px)
2.
ComboButtonNonClientWidth and
ComboButtonNonClientHeight = 90 (6px). Where are they? I see only two pixels on the right and two pixels on the left of the picture.
3.
ComboButtonClientWidth = 195 (13px). My icon has 32px width. What is 13px?
https://www.vbforums.com/images/ieimages/2024/03/24.png
1.
Top 0 is correct. A cell has 2 grid border lines. It appears as a square border as the neighbor cell draws the other 2.
2.
6px is correct. 3 left and 3 right. It's non-client.
3.
If you have a larger icon then change ComboButtonWidth (Let).
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
1.
Top 0 is correct. A cell has 2 grid border lines. It appears as a square border as the neighbor cell draws the other 2.
Ok, I had to repost my previous screenshot. The top offset is NOT absent here (it is 1px). How could it happen? How can I change this?
https://www.vbforums.com/images/ieimages/2024/03/4.png
Quote:
Originally Posted by
Krool
2.
6px is correct. 3 left and 3 right. It's non-client.
The red square is my icon's area . I see only two pixels on the right and two pixels on the left of the picture. Do you mean that 1px offset near the right border is non-client area too?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
Ok, I had to repost my previous screenshot. The top offset is NOT absent here (it is 1px). How could it happen? How can I change this?
https://www.vbforums.com/images/ieimages/2024/03/4.png
The red square is my icon's area . I see only two pixels on the right and two pixels on the left of the picture. Do you mean that 1px offset near the right border is non-client area too?
You changed the grid line compared to previous screenshot. If you have FixGridLineOffsets to False (default) it's offsets are the same as in MSFlexGrid.
Yes, 1 px nearby is non-client as well. I don't dream these px. It's coming from an API how MS actually draws it.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
Included the MimicTextBox and ColMimicTextBox/ColMimicTextBoxFixed property. (Defaults to False)
DT_EDITCONTROL will mimic the text-displaying characteristics of a multiline text box. This includes to break on characters instead on words.
This is only meaningful if the word wrap property is set to true.
The main benefit is to have no drawing difference anymore when editing a cell.
The OCX VBFLXGRD17 was also updated. The internal type lib version is now 1.8.
Code:
Object={2DA70529-3366-414A-B408-46083BCD481B}#1.8#0; VBFLXGRD17.OCX
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
A brief description of the properties that return the dimensions of the ComboButton.
The Legend and corresponding VBFlexGrid properties:
RH = RowHeight = 20px * 15 = 300 twips.
NCH = ComboButtonNonClientHeight = (3px+3px) * 15 = 90 twips incl. GridLineOffsets.
NCW = ComboButtonNonClientWidth = (3px+3px) * 15 = 90 twips incl. GridLineOffsets.
CW = ComboButtonClientWidth = ComboButtonWidth – ComboButtonNonClientWidth
The parameters returned byf the GetGridLineOffsets method:
- Bottom (the "BO" on the pictures) = 1px * 15 = 15 twips
- Right (the "RO" on the pictures) = 1px * 15 = 15 twips
- Left (not indicated on the pictures) = 0
- Top (not indicated on the pictures) = 0
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi again!
I can use:
Code:
.ColComboMode(.Col) = FlexComboModeDropDown
.ColComboItems(.Col) = "option1|option2|option3|..."
And all the column will have a with this options.
But..
Can i put only in one cell a combo ?, not the entire column.
Or can i put a combo in a entire row ? (it will be better to use a cell, but a row can be fine)
Edit:
I found a way (don't know if it's the right one)
Using colcombomode for the column and using then .CellComboCue = FlexComboCueNone on the cells i don't want a combo
Edit2:
No... this way is not working either...
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Calcu
Hi again!
I can use:
Code:
.ColComboMode(.Col) = FlexComboModeDropDown
.ColComboItems(.Col) = "option1|option2|option3|..."
And all the column will have a with this options.
But..
Can i put only in one cell a combo ?, not the entire column.
Or can i put a combo in a entire row ? (it will be better to use a cell, but a row can be fine)
Edit:
I found a way (don't know if it's the right one)
Using colcombomode for the column and using then .CellComboCue = FlexComboCueNone on the cells i don't want a combo
Edit2:
No... this way is not working either...
Instead of using the ColComboMode just set the ComboMode/ComboItems upon the BeforeEdit event. There you can control exactly which row/col have what setting.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
There are several very useful properties in FarPoint-Spread:
Code:
Property Get/Let EditModePermanent As Boolean
Property Get/Let EditModeReplace As Boolean
Property Get/Let EditModeAutomatic As Boolean
Property Get/Let EditEnterAction As EditEnterActionConstants
Public Enum EditEnterActionConstants
EditEnterActionNone = 0
EditEnterActionUp = 1
EditEnterActionDown = 2
EditEnterActionLeft = 3
EditEnterActionRight = 4
EditEnterActionNext = 5
EditEnterActionPrevious = 6
EditEnterActionSame = 7
EditEnterActionNextRow = 8
End Enum
When EditModePermanent = True, when we move or click any grid cell, the cell is always in the editing state.
It would be great if VBFlexGrid could also add EditModePermanent property.
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi Krool,
I've been playing around with the VBFlexGrid package in tB, and noticed any issue that I've also been able to reproduce with the v1.7 OCX in VB6.
Consider the following code for a Form with a unmodified VBFlexGrid dropped on to it:
Code:
Option Explicit
Private Sub Form_Load()
With Me.VBFlexGrid1
.Font.Name = "Segoe UI"
.FontFixed.Bold = True
.TextMatrix(0, 0) = "ABCDEF"
.TextMatrix(1, 1) = "ABCDEF"
End With
End Sub
After running the above, I expected the fixed cells to use a Bold variant of the font, and the non-fixed cells to use the regular/non-Bold font, but the result was that all cells used the Bold variant:
Attachment 191076
Perhaps this is by design, but IMO the result is unexpected/unwanted as the purpose of have 2 separate Font properties would be to have two disconnected fonts that can have their properties set independently.
In any case, I can use .Cell(FlexCellFontBold... to get the behaviour I want, but I thought I'd bring this to your attention in case it is something that needs fixing (again, assuming this isn't by the design and I'm just misunderstanding the purpose of the separate Font properties). Thanks for your time.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
jpbro
Hi Krool,
I've been playing around with the VBFlexGrid package in tB, and noticed any issue that I've also been able to reproduce with the v1.7 OCX in VB6.
Consider the following code for a Form with a unmodified VBFlexGrid dropped on to it:
Code:
Option Explicit
Private Sub Form_Load()
With Me.VBFlexGrid1
.Font.Name = "Segoe UI"
.FontFixed.Bold = True
.TextMatrix(0, 0) = "ABCDEF"
.TextMatrix(1, 1) = "ABCDEF"
End With
End Sub
After running the above, I expected the fixed cells to use a Bold variant of the font, and the non-fixed cells to use the regular/non-Bold font, but the result was that all cells used the Bold variant:
Attachment 191076
Perhaps this is by design, but IMO the result is unexpected/unwanted as the purpose of have 2 separate Font properties would be to have two disconnected fonts that can have their properties set independently.
In any case, I can use
.Cell(FlexCellFontBold... to get the behaviour I want, but I thought I'd bring this to your attention in case it is something that needs fixing (again, assuming this isn't by the design and I'm just misunderstanding the purpose of the separate Font properties). Thanks for your time.
Thanks for bringing this up.
But, it's not a bug but a feature. :)
The behavior is the same as in MSHFlexGrid.
You can easily solve this "issue" by doing as following:
Code:
With VBFlexGrid1
.Font.Name = "Segoe UI"
Set .FontFixed = New StdFont ' Must be!
.FontFixed.Bold = True
.TextMatrix(0, 0) = "ABCDEF"
.TextMatrix(1, 1) = "ABCDEF"
End With
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Thanks for bringing this up.
But, it's not a bug but a feature. :)
The behavior is the same as in MSHFlexGrid.
Ahh, gotcha! I work a fair amount with the Codejock ReportControl and it has separate Font properties for things like headers/footers/etc.. that all act independentl, so that coloured my expectations. Thank you for demonstrating the correct approach when working with VBFlexGrid :)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
SearchingDataOnly
There are several very useful properties in FarPoint-Spread:
Code:
Property Get/Let EditModePermanent As Boolean
Property Get/Let EditModeReplace As Boolean
Property Get/Let EditModeAutomatic As Boolean
Property Get/Let EditEnterAction As EditEnterActionConstants
Public Enum EditEnterActionConstants
EditEnterActionNone = 0
EditEnterActionUp = 1
EditEnterActionDown = 2
EditEnterActionLeft = 3
EditEnterActionRight = 4
EditEnterActionNext = 5
EditEnterActionPrevious = 6
EditEnterActionSame = 7
EditEnterActionNextRow = 8
End Enum
When EditModePermanent = True, when we move or click any grid cell, the cell is always in the editing state.
It would be great if VBFlexGrid could also add
EditModePermanent property.
The EditEnterAction there is something similar, see the DirectionAfterReturn property.
For EditModePermanent. Did you try just as below ?
Code:
Private Sub VBFlexGrid1_RowColChange()
VBFlexGrid1.StartEdit
End Sub
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
I've added the following code to mock the EditModePermanent property of Farpoint-Spread:
Code:
Private Sub ChkEditModePermanent_Click()
If ChkEditModePermanent.Value = 1 Then
VBFlexGrid1.AllowUserEditing = True
VBFlexGrid1.DirectionAfterReturn = FlexDirectionAfterReturnRight
VBFlexGrid1.FocusRect = FlexFocusRectNone
VBFlexGrid1.HighLight = FlexHighLightNever
End If
End Sub
Private Sub VBFlexGrid1_RowColChange()
If ChkEditModePermanent.Value = 1 Then
VBFlexGrid1.StartEdit
End If
End Sub
Yes, when I click on a cell, the cell is in the editing state. But one problem is that when I need to press Return key to move the CellEditBox to the next cell, I need to press Return key twice, which is very inconvenient, so I can't use VBFlexGrid to fully emulate the EditModePermanent property of Farpoint-Spread at the moment.
If VBFlexGrid can provide more powerful and smooth input capabilities, then the use cases of VBFlexGrid will be greatly expanded, for example, we can use VBFlexGrid to emulate and replace RichTextBox.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
SearchingDataOnly
I've added the following code to mock the EditModePermanent property of Farpoint-Spread:
Code:
Private Sub ChkEditModePermanent_Click()
If ChkEditModePermanent.Value = 1 Then
VBFlexGrid1.AllowUserEditing = True
VBFlexGrid1.DirectionAfterReturn = FlexDirectionAfterReturnRight
VBFlexGrid1.FocusRect = FlexFocusRectNone
VBFlexGrid1.HighLight = FlexHighLightNever
End If
End Sub
Private Sub VBFlexGrid1_RowColChange()
If ChkEditModePermanent.Value = 1 Then
VBFlexGrid1.StartEdit
End If
End Sub
Yes, when I click on a cell, the cell is in the editing state. But one problem is that when I need to press Return key to move the CellEditBox to the next cell, I need to press Return key twice, which is very inconvenient, so I can't use VBFlexGrid to fully emulate the EditModePermanent property of Farpoint-Spread at the moment.
If VBFlexGrid can provide more powerful and smooth input capabilities, then the use cases of VBFlexGrid will be greatly expanded, for example, we can use VBFlexGrid to emulate and replace RichTextBox.
Good point. Need to think about.
IMO it should be like Excel. When pressing return finish editing and move to the direction.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Good point. Need to think about.
IMO it should be like Excel. When pressing return finish editing and move to the direction.
Yes, it would be exciting if VBFlexGrid could replace (or partially replace) RichTextBox and Excel.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
Return key will be forwarded according to DirectionAfterReturn property after editing. (like as the TabBehavior property)
Thanks again for the good point which I missed somehow.
To note is that "shift-return" (opposite of DirectionAfterReturn property) will work only when drop-down list is down (list or calendar) and return key is pressed.
On normal state a "shift-return" will enter a line feed and a "alt-return" a carriage return.
Or should we overwrite behavior ? E.g. Excel does not allow "shift-return" to input a line feed.. and instead ends editing and moves the caret to opposite direction.
So...
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hello Krool
First of all, I wanted to congratulate you on your work.
Many years ago, I worked a lot with Microsoft's FlexGrid. Now, although I have almost no time available, I am trying to get back into the habit of writing code.
I wanted to tell you some things regarding Microsoft's FlexGrid, which, in my humble opinion, could even be considered bad behavior.
At the time, I wrote them here:
https://www.lawebdelprogramador.com/...-FlexGrid.html
This is very extensive, perhaps you could summarize these topics, and present them here
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
1) Clicks that should not choose a Row
1.1) When the FlexGrid has an unfilled space by Rows, below the last Row, and a Click or DoubleClick is made in that sector, what I believe is an erroneous behavior of the Control is generated.
The FlexGrid, in this case, updates the Row property, with the index of the last Row existing in it
We repeat, the last Row was not Clicked, but the Row Property is updated with its Index
This even happens with RowHeight equal to 0, that is, although the last Row is invisible.
1.2) Something similar happens when you Click on a Row of Fixed Cells.
In this case, the Row property is updated, with the index of the first non-Fixed Row
We repeat, the first Row was not Clicked, but the Row Property is updated with its Index
Maybe I'm wrong, but in my humble opinion, this behavior does not seem to be logical or expected.
In my particular case, I have written code to detect this situation, and avoid the execution of the corresponding events
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
2) The MSFlexGrid does not allow avoiding multi-selection of Rows.
This is strange, since the most common need is that the User must choose only 1 Row.
Sometimes it happens that by a quick mouse movement, combined with a click, without intending it, the user ends up selecting several Rows.
In a context where being requires selecting only one Row, this does not seem like good behavior
There should be a Property that defines the Selection Mode, between multiple and just one.
I don't remember very well, but I think it doesn't exist. I hope I am wrong, because it seems to me that the existence of this property is something very elementary.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
3) If the Control has hundreds of Rows, and .Rows = 0 is executed with the intention of eliminating all the Rows of the control, once in many, that is, at random, the dreaded "Automation Error" occurs
I remember, this error drove me crazy, because it was very erratic and unpredictable, but from time to time it happened. Furthermore, it is something that only happened if the control had hundreds of rows, which is unlikely and also generally useless. Either way it doesn't have to happen.
Although it is very strange, I solved it by executing .Rows = 1 and then .Rows = 0, that is, downloading the Control in 2 steps
This doesn't make any logic, but this way I never run into this error again.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
4) Query about events in the VBFlexGrid
Is the sequence of events in the VBFlexGrid the same as that in MSFlexGrid?
I have not translated it, but here I leave how the latter behaves, in the different situations that may arise.
Thank you so much
Code:
'EVENTOS EN EL FLEXGRID
'¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
' Perdida de Foco del Control sin que haya variado el Contenido de la Cela Activa: LostFocus
' Perdida de Foco del Control siendo que el Contenido de la Cela Activa ha variado: Validate, LostFocus
' Recibir el Foco a traves de la Tecla TAB: GotFocus
' Sin que el Control tenga el Foco, al Hacer Click en la Cela Activa: MouseDown, GotFocus, SelChange, MouseUp, Click
' Sin que el Control tenga el Foco, al Hacer Click en Otra Celda: LeaveCell, EnterCell, RowColChange, MouseDown, GotFocus, SelChange, MouseUp, Click
' Al Hacer Click en Celda Activa y soltar sin arrastrar: MouseDown, MouseUp, Click
' Al Hacer Click en Celda Activa, arrastrar, y seleccionar lo ya Seleccionado: MouseDown, MouseUp, Click
' Al Hacer Click en Celda Activa, arrastrar, y seleccionar otra Area: MouseDown, SelChange, MouseUp, Click
' Al Hacer Click en Otra Celda: LeaveCell, EnterCell, RowColChange, MouseDown, SelChange, MouseUp, Click
' Al Hacer Click en Otra Celda y Arrastrar, y Seleccionar un Area: LeaveCell, EnterCell, RowColChange, MouseDown, SelChange, MouseUp, Click
'
' Al Hacer Doble Click en Celda Activa: MouseDown, MouseUp, Click, DblClick, MouseUp
' Al Hacer Doble Click en Otra Celda: LeaveCell, EnterCell, RowColChange, MouseDown, SelChange, MouseUp, Click, DblClick, SelChange, MouseUp
' Al Mover la Celda Activa con las Flechas del Cursor en cualquier direccion: LeaveCell, EnterCell, RowColChange, SelChange, KeyDown, KeyPress, KeyUp
' Si al hacer lo anterior se produce un Scroll: LeaveCell, Scroll, EnterCell, RowColChange, SelChange, KeyDown, KeyPress, KeyUp
' Al hacer un Scroll: Scroll (y ningun evento mas)
' Es un evento por cada 'saltito de pantalla' o desplazamiento del alto de la celda que desaparece
' No se puede Seleccionar las Celdas Fijas, pero al pulsar sobre las Celdas Fijas, se puede motivar un cambio de Seleccion en las No Fijas, y esto acarrea los eventos correspondientes.
' SelChange ocurre tambien por programa cuando se modifica .Row .Col .RowSel .ColSel
' El Evento DblClick, sucede en una segunda instancia o cadena de eventos, que se suceden desde el momento en que ocurre el 2do Click.
' Este tiempo intermedio entre las dos cadenas de Eventos, puede variar segun la velocidad con que el Usuario realiza el Doble Click y segun como este seteado 'La Velocidad del DobleClick' en el Panel de Control de Windows.
' Si por el tiempo transcurrido entre los dos Click, no alcanza para considerarse un Doble Click, la segunda cadena de Eventos (DblClick, MouseUp) no se produce, y en cambio, se produce nuevamente la primera (MouseDown, MouseUp, Click). -Se pusieron como ejemplo las cadenas cortas generadas por Click seguidos en la misma Celda-.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Update released.
Return key will be forwarded according to DirectionAfterReturn property after editing. (like as the TabBehavior property)
It's great and I'll be testing it carefully next week.
Quote:
Originally Posted by
Krool
Update released.
On normal state a "shift-return" will enter a line feed and a "alt-return" a carriage return.
Or should we overwrite behavior ? E.g. Excel does not allow "shift-return" to input a line feed.. and instead ends editing and moves the caret to opposite direction.
So...
I don't quite understand what you mean.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Or should we overwrite behavior ? E.g. Excel does not allow "shift-return" to input a line feed.. and instead ends editing and moves the caret to opposite direction.
So...
IMO the Excel-style behavour is better, because "alt-return" is enougth. On the other hand - I have never used the "shift-return" or "shift-tab" in Excel or where ever else. I use the "up" and "left" arrows instead. So leave it as it is.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
SearchingDataOnly
I don't quite understand what you mean.
Shift-Return will cause a WM_CHAR of 13 (Carriage return) while a Ctrl-Return will cause a WM_CHAR of 10 (Linefeed)
Of course the Alt-Return will work also (13) in the editing box. (But not in a regular TextBox)
So as Nouyana suggested there will be no leave of editing upon a Shift-Return as to allow a WM_CHAR of 13 (like a TextBox). Alt-Return maybe users are not aware as a TextBox does not allow it either.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi Krool
I wonder if there is an option to autosize the height of the grid based on the number of items in the grid.
I'm not asking about the row and column autosize but rather the grid height autosize?
thank you
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Another problem
I was using this module to populate VbFlexgrid V 1.4 and everything Ok
Now I upraded to 1.7 and I get error of mismatch
Code:
Public Sub CalendarFlexShow(Flex As VBFlexGrid, mvarYear As Long)
On Error Resume Next
Dim i As Long, j As Long
Dim Days As Long
Dim mvarDate As Date
Dim Ft() As String
With Flex
.Redraw = False
.Rows = 33
.Cols = 14
.FixedCols = 0
.FixedRows = 2
.Clear
.TextMatrix(0, 0) = CStr(mvarYear - 1)
.TextMatrix(1, 0) = MonthName(12)
For i = 1 To 12
.TextMatrix(0, i) = CStr(mvarYear)
.TextMatrix(1, i) = MonthName(i)
Next
.TextMatrix(0, 13) = CStr(mvarYear + 1)
.TextMatrix(1, 13) = MonthName(1)
.Row = 0
For i = 0 To .Cols - 1
.Col = i
.CellAlignment = flexAlignCenterCenter
Next
For i = 1 To 12
CalendarFlexMonth Flex, i, mvarYear, i
Next
CalendarFlexMonth Flex, 12, mvarYear - 1, 0
CalendarFlexMonth Flex, 1, mvarYear + 1, 13
If mvarYear = Year(Now) Then
.Col = Month(Now)
.Row = Day(Now) + 1
ElseIf (mvarYear = Year(Now) - 1) And (Month(Now) = 12) Then
.Col = 0
.Row = Day(Now) + 1
ElseIf (mvarYear = Year(Now) + 1) And (Month(Now) = 1) Then
.Col = 13
.Row = Day(Now) + 1
Else
.Col = 1
.Row = 0
End If
.Redraw = True
End With
End Sub
Code:
Private Sub CalendarFlexMonth(Flex As VBFlexGrid, mvarMonth As Long, _
mvarYear As Long, Col As Long)
Dim Days As Long, i As Long, j As Long, k As Long
Dim mvarDate As Date
Dim Datum As Date
Dim s As String
mvarDate = DateSerial(mvarYear, mvarMonth, 1)
Days = Day(DateAdd("m", 1, mvarDate) - 1)
With Flex
.Col = Col
For i = 1 To Days
.Row = i + 1
s = Format(i, "00") & Space(2)
If Weekday(mvarDate, vbSunday) = 7 Then
'color Sunday
s = s & Format(mvarDate, "ddd")
.CellForeColor = vbBlue
.CellBackColor = &HE0E0E0
ElseIf Weekday(mvarDate, vbSunday) = 6 Then
'color Saturday
s = s & Format(mvarDate, "ddd")
.CellForeColor = vbBlue
.CellBackColor = &HE0E0E0
Else
s = s & Format(mvarDate, "ddd")
.CellForeColor = vbBlack
End If
.Text = s
.CellAlignment = flexAlignLeftCenter
mvarDate = mvarDate + 1
Next
End With
End Sub
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Mustaphi
Another problem
I was using this module to populate VbFlexgrid V 1.4 and everything Ok
Now I upraded to 1.7 and I get error of mismatch
Code:
Public Sub CalendarFlexShow(Flex As VBFlexGrid, mvarYear As Long)
On Error Resume Next
Dim i As Long, j As Long
Dim Days As Long
Dim mvarDate As Date
Dim Ft() As String
With Flex
.Redraw = False
.Rows = 33
.Cols = 14
.FixedCols = 0
.FixedRows = 2
.Clear
.TextMatrix(0, 0) = CStr(mvarYear - 1)
.TextMatrix(1, 0) = MonthName(12)
For i = 1 To 12
.TextMatrix(0, i) = CStr(mvarYear)
.TextMatrix(1, i) = MonthName(i)
Next
.TextMatrix(0, 13) = CStr(mvarYear + 1)
.TextMatrix(1, 13) = MonthName(1)
.Row = 0
For i = 0 To .Cols - 1
.Col = i
.CellAlignment = flexAlignCenterCenter
Next
For i = 1 To 12
CalendarFlexMonth Flex, i, mvarYear, i
Next
CalendarFlexMonth Flex, 12, mvarYear - 1, 0
CalendarFlexMonth Flex, 1, mvarYear + 1, 13
If mvarYear = Year(Now) Then
.Col = Month(Now)
.Row = Day(Now) + 1
ElseIf (mvarYear = Year(Now) - 1) And (Month(Now) = 12) Then
.Col = 0
.Row = Day(Now) + 1
ElseIf (mvarYear = Year(Now) + 1) And (Month(Now) = 1) Then
.Col = 13
.Row = Day(Now) + 1
Else
.Col = 1
.Row = 0
End If
.Redraw = True
End With
End Sub
Code:
Private Sub CalendarFlexMonth(Flex As VBFlexGrid, mvarMonth As Long, _
mvarYear As Long, Col As Long)
Dim Days As Long, i As Long, j As Long, k As Long
Dim mvarDate As Date
Dim Datum As Date
Dim s As String
mvarDate = DateSerial(mvarYear, mvarMonth, 1)
Days = Day(DateAdd("m", 1, mvarDate) - 1)
With Flex
.Col = Col
For i = 1 To Days
.Row = i + 1
s = Format(i, "00") & Space(2)
If Weekday(mvarDate, vbSunday) = 7 Then
'color Sunday
s = s & Format(mvarDate, "ddd")
.CellForeColor = vbBlue
.CellBackColor = &HE0E0E0
ElseIf Weekday(mvarDate, vbSunday) = 6 Then
'color Saturday
s = s & Format(mvarDate, "ddd")
.CellForeColor = vbBlue
.CellBackColor = &HE0E0E0
Else
s = s & Format(mvarDate, "ddd")
.CellForeColor = vbBlack
End If
.Text = s
.CellAlignment = flexAlignLeftCenter
mvarDate = mvarDate + 1
Next
End With
End Sub
I just tried your code and no error. :confused:
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Mustaphi
Another problem
I was using this module to populate VbFlexgrid V 1.4 and everything Ok
Now I upraded to 1.7 and I get error of mismatch
Works fine with ver. 1.7.0.26
Try to check all your frm and vbp files for the OCX version. Use Notepad.
Or try to declare your sub this way:
Code:
Public Sub CalendarFlexShow(Flex As VBFLXGRD17.VBFlexGrid, mvarYear As Long)
On Error Resume Next
Dim i As Long, j As Long
Dim Days As Long
...
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
Works fine with ver. 1.7.0.26
Try to check all your frm and vbp files for the OCX version. Use Notepad.
Or try to declare your sub this way:
Code:
Public Sub CalendarFlexShow(Flex As VBFLXGRD17.VBFlexGrid, mvarYear As Long)
On Error Resume Next
Dim i As Long, j As Long
Dim Days As Long
...
thank you very much
it worked.
what about this?
Quote:
Originally Posted by
Mustaphi
Hi Krool
I wonder if there is an option to autosize the height of the grid based on the number of items in the grid.
I'm not asking about the row and column autosize but rather the grid height autosize?
thank you
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
VBFlexGrid1_EditSetupStyle
I can see from the demo, you can set certain columns to only accept certain data when using in cell editing. The demo shows how to lock a column to Numbers Only.
Can someone point me in the right direction, to lock a column down to decimals, able to store currency values. The OnlyNumbers one doesn't allow decimal points.
Thanks
Lee.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
logley
Can someone point me in the right direction, to lock a column down to decimals, able to store currency values.
See my post here.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Mustaphi
what about this?
No, the VBFlexGrid can't autosize it's height.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Mustaphi
what about this?
Maybe you can play with this:
Code:
xSuma = 0
For X = 0 To grid.Rows - 1
If grid.RowIsVisible(X) = True Then
xSuma = xSuma + grid.RowHeight(X)
End If
Next X
grid.Height = xSuma
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Calcu
Maybe you can play with this:
Code:
xSuma = 0
For X = 0 To grid.Rows - 1
If grid.RowIsVisible(X) = True Then
xSuma = xSuma + grid.RowHeight(X)
End If
Next X
grid.Height = xSuma
Thank you it worked
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Calcu
Maybe you can play with this:
Code:
xSuma = 0
For X = 0 To grid.Rows - 1
If grid.RowIsVisible(X) = True Then
xSuma = xSuma + grid.RowHeight(X)
End If
Next X
grid.Height = xSuma
This doesn't account the border height. So it's "almost" working.
Maybe it would be a good idea to make the "ClientHeight" property also write-able. So the grid adjust's it's border height on it's own.
So you would then do:
Code:
grid.ClientHeight = xSuma
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
This would be fan-tas-tic
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Updated manifest in the OCX thread which applies now the miscStatus* attributes. Thanks to wqweto and his UMMM tool.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Maybe it would be a good idea to make the "ClientHeight" property also write-able.
IMO yes, it would be more convenient to customize the grid. ClientHeight and ClientWidth.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
IMO yes, it would be more convenient to customize the grid. ClientHeight and ClientWidth.
Seems to be difficult due to the dynamic appearance of the scrollbars. So will not be included..
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi Krool,
When selecting a large number of grid-rows with the mouse, VBFlexGrid can only scroll through many pages at a very slow speed to select hundreds or thousands of grid-rows, which takes a lot of time. Is it possible to make VBFlexGrid able to scroll quickly when selecting a large number of grid-rows?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
SearchingDataOnly
Hi Krool,
When selecting a large number of grid-rows with the mouse, VBFlexGrid can only scroll through many pages at a very slow speed to select hundreds or thousands of grid-rows, which takes a lot of time. Is it possible to make VBFlexGrid able to scroll quickly when selecting a large number of grid-rows?
Do you have a FlexDataSource where the viewport data is fetched on demand?
Maybe that's the reason of "slow" scrolling on a large list ..
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Do you have a FlexDataSource where the viewport data is fetched on demand?
Maybe that's the reason of "slow" scrolling on a large list ..
No, I'm not using FlexDataSource. Attached is the test code (click the button "Load Large Data")
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
SearchingDataOnly
No, I'm not using FlexDataSource. Attached is the test code (click the button "Load Large Data")
I can't repro. I tested in the IDE and scrolling is normal.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
I can't repro. I tested in the IDE and scrolling is normal.
Yes, VBFlexGrid's scrolling is normal. I mean the VBFlexGrid should scroll a little faster, especially when the grid has a lot of rows, and the scrolling speed should be more than 3 times what it is now.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
SearchingDataOnly
Yes, VBFlexGrid's scrolling is normal. I mean the VBFlexGrid should scroll a little faster, especially when the grid has a lot of rows, and the scrolling speed should be more than 3 times what it is now.
How?
One scroll should scroll "1 page", that's it.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
I don't know if anyone understands what I mean. If anyone understands what I mean, hopefully he could explain it to Krool.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Can you record a video of your screen? Maybe then....
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
SearchingDataOnly
I don't know if anyone understands what I mean. If anyone understands what I mean, hopefully he could explain it to Krool.
Do you want non linear scrolling?
The longer you keep the arrow button or page down button pressed the bigger the step?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Thank you, Calcu and Arnoutdv.
I'll rephrase my problem.
When we need to select a lot of grid rows with the mouse, we do it like this:
(1) Click on the first row you want to select
(2) Hold down the mouse and drag down, and the grid rows will start to scroll
(3) Soon, the mouse moves to the bottom of the grid component and moves outside the grid.
(4) When the mouse has moved outside the grid the grid should continue to scroll, and the scrolling speed should be more than three times the normal scrolling speed (i.e., the speed of the mouse inside the grid).
(5) When all the grid rows to be selected have been included, the mouse should move up to the grid, and the scrolling speed of the grid will return to the normal state (i.e., slow down). At this point, the mouse can select exactly the hundreds or thousands of rows that need to be selected.
My requirement is that when the mouse has moved outside of the grid, the grid should scroll at more than three times the normal scrolling speed (i.e., the speed of the mouse inside the grid).
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
SearchingDataOnly
Thank you, Calcu and Arnoutdv.
I'll rephrase my problem.
When we need to select a lot of grid rows with the mouse, we do it like this:
(1) Click on the first row you want to select
(2) Hold down the mouse and drag down, and the grid rows will start to scroll
(3) Soon, the mouse moves to the bottom of the grid component and moves outside the grid.
(4) When the mouse has moved outside the grid the grid should continue to scroll, and the scrolling speed should be more than three times the normal scrolling speed (i.e., the speed of the mouse inside the grid).
(5) When all the grid rows to be selected have been included, the mouse should move up to the grid, and the scrolling speed of the grid will return to the normal state (i.e., slow down). At this point, the mouse can select exactly the hundreds or thousands of rows that need to be selected.
My requirement is that when the mouse has moved outside of the grid, the grid should scroll at more than three times the normal scrolling speed (i.e., the speed of the mouse inside the grid).
So like in the reader mode? (AllowReaderMode = True and click or hold down middle mouse button)
There the scroll is faster/slower depedent on the "distance" to the anchor..
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
So like in the reader mode? (AllowReaderMode = True and click or hold down middle mouse button)
There the scroll is faster/slower depedent on the "distance" to the anchor..
It doesn't seem to have anything to do with reader mode. You can try selecting 5,000 rows from 30,000 grid rows with your mouse and see how much time it takes.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
SearchingDataOnly
It doesn't seem to have anything to do with reader mode. You can try selecting 5,000 rows from 30,000 grid rows with your mouse and see how much time it takes.
OMG. We really can't understand. I said LIKE mechanism of reader mode.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
@SearchingDataOnly: I've tried it in a grid with about 4.500 Rows. Selected row 1 and moved down outside the control, still button pressed. Now moved the mouse erratic fast outside the control, e.g. to the left and right, and so the selection in the grid sped up. Is this like what you want to have? In my opinion the selection speeds up with the movement of the mouse, and it is fast.
Greetings
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Seniorchef
@SearchingDataOnly: I've tried it in a grid with about 4.500 Rows. Selected row 1 and moved down outside the control, still button pressed. Now moved the mouse erratic fast outside the control, e.g. to the left and right, and so the selection in the grid sped up. Is this like what you want to have? In my opinion the selection speeds up with the movement of the mouse, and it is fast.
Greetings
Yes, you understand exactly what I mean. Thank you, Seniorchef.
Have you ever tried to select 5,000 grid rows out of 50,000?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
I personally am not a big fan of doing such a select using "auto scrolling", and especially not when the scroll starts accelerating, as it's usually hard to stop at the right moment. I would select the first row, use the slider in the scrollbar to quickly go to the end of the selection, press <Shift> and then click the last row that has to be selected.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Erwin69
I personally am not a big fan of doing such a select using "auto scrolling", and especially not when the scroll starts accelerating, as it's usually hard to stop at the right moment. I would select the first row, use the slider in the scrollbar to quickly go to the end of the selection, press <Shift> and then click the last row that has to be selected.
The ScrollTip functionality can help here to get quick preview of where the scroll would jump.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
@SearchingDataOnly: I tested it on a 84,000 rows grid in the IDE (I had to change my code to display the number of selected rows) and it took me 5 seconds to mark about 5,000 rows - in my opinion it's fast (and my PC is really outdated :-)). But as Erwin69 mentioned, it's almost impossible to stop on a certain row. So I'd prefer another method to select that much rows, e.g. via keyboard (ctrl + pagedown, slower) or via code (if possible). So in the first place, what's the goal?
Greetings
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
...I said LIKE mechanism of reader mode.
Yep, the greater the (Pixel-)-distance in y-Direction from a "Fix-Point" -
the higher the "Rows-per-Tick"-speed in the ScrollTimer-Event (which you probably already have anyways).
The only difference is, that there's now two "Fix-points" you measure Pixel-distances from:
- in Scroll-down-mode, the Pixel-Diff is measured as Delta to the BottomLine of the Ctl
- in Scroll-up-mode, to the Top-Line of the Ctl respectively
For the cwVList-Widget, I think I have 3 speed-levels (related to the Pixel-Delta):
- 1-15 = "normal speed"
- 16-30 = "higher speed"
- > 30 = "highest speed"
Olaf