-
Mar 28th, 2024, 04:12 AM
#1321
Hyperactive Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 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?
-
Mar 28th, 2024, 11:27 AM
#1322
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 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?

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).
-
Mar 28th, 2024, 01:07 PM
#1323
Hyperactive Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 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?

 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?
-
Mar 28th, 2024, 01:30 PM
#1324
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 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?
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.
-
Mar 29th, 2024, 01:17 PM
#1325
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
-
Mar 31st, 2024, 12:21 PM
#1326
Hyperactive Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
A brief description of the properties that return the dimensions of the ComboButton.
GridLines = FlexGridLineInset
( 2px grid) |
GridLines = FlexGridLineFlat
( 1px grid) |
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
-
Apr 3rd, 2024, 04:20 AM
#1327
Addicted Member
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...
Last edited by Calcu; Apr 3rd, 2024 at 06:25 AM.
-
Apr 3rd, 2024, 08:07 AM
#1328
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 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.
-
Apr 8th, 2024, 07:36 AM
#1329
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.
Last edited by SearchingDataOnly; Apr 8th, 2024 at 08:06 AM.
-
Apr 8th, 2024, 11:32 AM
#1330
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:

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.
-
Apr 8th, 2024, 11:47 AM
#1331
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 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:
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
-
Apr 8th, 2024, 11:56 AM
#1332
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 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
-
Apr 10th, 2024, 02:58 AM
#1333
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 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
-
Apr 11th, 2024, 01:26 AM
#1334
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.
Last edited by SearchingDataOnly; Apr 11th, 2024 at 01:30 AM.
-
Apr 11th, 2024, 02:19 AM
#1335
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 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.
-
Apr 11th, 2024, 02:44 AM
#1336
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 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.
-
Apr 11th, 2024, 11:13 AM
#1337
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...
Last edited by Krool; Apr 11th, 2024 at 11:26 AM.
-
Apr 11th, 2024, 07:23 PM
#1338
Lively Member
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
Last edited by Tabi; Apr 11th, 2024 at 07:47 PM.
-
Apr 11th, 2024, 08:18 PM
#1339
Lively Member
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
-
Apr 11th, 2024, 08:45 PM
#1340
Lively Member
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.
Last edited by Tabi; Apr 11th, 2024 at 08:49 PM.
-
Apr 11th, 2024, 09:05 PM
#1341
Lively Member
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.
-
Apr 11th, 2024, 09:16 PM
#1342
Lively Member
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-.
-
Apr 12th, 2024, 07:25 AM
#1343
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 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.
 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.
-
Apr 12th, 2024, 09:14 AM
#1344
Hyperactive Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 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.
-
Apr 12th, 2024, 10:30 AM
#1345
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 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.
-
Apr 12th, 2024, 04:41 PM
#1346
Fanatic Member
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
-
Apr 12th, 2024, 06:26 PM
#1347
Fanatic Member
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
-
Apr 13th, 2024, 01:33 AM
#1348
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 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.
-
Apr 13th, 2024, 07:28 AM
#1349
Hyperactive Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 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
...
-
Apr 13th, 2024, 01:07 PM
#1350
Fanatic Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 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?
 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
Last edited by Mustaphi; Apr 13th, 2024 at 02:12 PM.
-
Apr 16th, 2024, 10:14 AM
#1351
Junior Member
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.
-
Apr 17th, 2024, 11:03 AM
#1352
Hyperactive Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 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.
-
Apr 17th, 2024, 11:10 AM
#1353
Hyperactive Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 Originally Posted by Mustaphi
what about this?
No, the VBFlexGrid can't autosize it's height.
-
Apr 18th, 2024, 12:28 PM
#1354
Addicted Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 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
-
Apr 18th, 2024, 02:44 PM
#1355
Fanatic Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 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
-
Apr 19th, 2024, 11:25 AM
#1356
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 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
-
Apr 20th, 2024, 03:20 AM
#1357
Addicted Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
This would be fan-tas-tic
-
Apr 20th, 2024, 01:08 PM
#1358
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.
-
Apr 22nd, 2024, 01:17 AM
#1359
Hyperactive Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 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.
-
Apr 22nd, 2024, 06:51 AM
#1360
Hyperactive Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Last edited by Nouyana; Apr 22nd, 2024 at 12:50 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|