-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Delete respects now the ClipMode (= ExcludeHidden)
Doesn't work for me.
Code:
Private Sub Command1_Click()
With VBFlexGrid1
.ClipPasteMode = FlexClipPasteModeNormal
.Col = 1: .Row = 1
.ColSel = 3: .RowSel = 2
.ColHidden(2) = True
.Delete ' The hidden col(2) was cleaned too
' .Clear FlexClearClip, FlexClearText
.ColHidden(2) = False
.SetFocus
End With
End Sub
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
Doesn't work for me.
Code:
Private Sub Command1_Click()
With VBFlexGrid1
.ClipPasteMode = FlexClipPasteModeNormal
.Col = 1: .Row = 1
.ColSel = 3: .RowSel = 2
.ColHidden(2) = True
.Delete ' The hidden col(2) was cleaned too
' .Clear FlexClearClip, FlexClearText
.ColHidden(2) = False
.SetFocus
End With
End Sub
Delete "respects" the ClipMode property. By that you need to set it of course to ExcludeHidden.
Add below code and it suddenly works.
Code:
.ClipMode = FlexClipModeExcludeHidden
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
By that you need to set it of course to ExcludeHidden.
https://www.vbforums.com/images/ieimages/2024/02/2.gif
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Included enum FlexDirectionAfterReturnEdit/FlexEditReasonReturn.
By this the edit mode is initiated by the return key, but only when shift state is 0.
It is intentionality included in the DirectionAfterReturn property to not change default behavior and it's logical because you can either move the cursor or start edit mode, but not both.
The OCX VBFLXGRD17 was also updated. The internal type lib version is now 1.5.
Code:
Object={2DA70529-3366-414A-B408-46083BCD481B}#1.5#0; VBFLXGRD17.OCX
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Krool, did you notice my message?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
A bug?
Code:
Private Sub Command1_Click()
With VBFlexGrid1
.Align = vbAlignTop ' If Align = vbAlignTop
Set .Container = Picture1 ' and the Container is set to a PictureBox
.ScrollBars = vbVertical ' then I can't see any scrollbars.
End With
End Sub
Do you adjust the width/height of the VBFlexGrid so it fits into the PictureBox?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Do you adjust the width/height of the VBFlexGrid so it fits into the PictureBox?
I use the Align = vbAlignTop only. It adjusts the width. Nothing more.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
I use the Align = vbAlignTop only. It adjusts the width. Nothing more.
Well, the code makes no sense. Because first of all the Align property works only when placed on a Form. Not in a PictureBox.
And you set the Align "prior" to changing the container. So the FlexGrid Width is then qual to the Form Width. Is that intended by you?
If your PictureBox width is now "smaller" then guess what, you don't "see" the scrollbars.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Align property works only when placed on a Form.
I didn't know it. Can you fix it?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
I didn't know it. Can you fix it?
No I can't. Align is a vb6 property.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hello Mr. Krool,
I need your help.
I get the following error: ERROR VBCCR17 Run-time error '50003'; Unexpected error.
I have a form where I am using imagelist as an image container for a menu bar,
the icons are 16x16 pixels, generated from .svg files (with old traditional .ico no problem),
In Windows 10 I do not have any problem,
the problem occurs in some versions of windows 7 service pack 1,
I have tried it on a vm with windows 7 sp1 and it has not given me any problems.
What library do you use to load the images that may be outdated in these Windows.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
vb6nostalgia
Hello Mr. Krool,
I need your help.
I get the following error: ERROR VBCCR17 Run-time error '50003'; Unexpected error.
I have a form where I am using imagelist as an image container for a menu bar...
You should repost it here.
https://www.vbforums.com/images/ieimages/2024/02/3.gif
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
TheLeePiper
Thanks so much. I looked at the vsFlexGrid API calls. For reference, the DataTable API looks like:
Datatbl1.CellSet(0,0).BorderColor = RGB(255, 0, 0)
Datatbl1.CellSet(0,0).BorderWidth = 1
CellSet can point to any arbitrary cell, CurCell to the cell with focus. Any cell where the BorderWidth is zero (the default) does not show a border. Not quite sure how this might map to the VBFlexGrid.
Borders are inside the grid, which of course, would affect ComboButton sizing (which it does with the DataTable). Just ignorantly free-thinking here, could it be a variant of the FlexCellBackColor usage? Instead of coloring the whole cell BG, it could be just an inset width? Set the right-side inset from any ComboButton so you would not need to modify the buttons? (Not quite the same as the DataTable, but would be very suitable for our needs.) Thanks again.
I am still struggling of "best way".
How about a CellGridLines property which overwrites the general grid lines?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
Thank you. I was in the wrong place.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
I am still struggling of "best way".
How about a CellGridLines property which overwrites the general grid lines?
That absolutely could work. Would this cell border thickness need to be the same as the default GridLineWidth?
Just for reference, we use cell BG colors for navigation control (i.e, to determine a tab stop for editing). For a new theme, we want to have white grid BG and grid line with "tab stop" cells that are slightly-off-white and a dark cell border for the visual indicator of these cells. (In other themes, the grid BGs are non-white and cell BGs are sufficiently different, so no border is needed. But we may add the border to these anyway for additional distinction.)
Thanks!
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
TheLeePiper
That absolutely could work. Would this cell border thickness need to be the same as the default GridLineWidth?
Just for reference, we use cell BG colors for navigation control (i.e, to determine a tab stop for editing). For a new theme, we want to have white grid BG and grid line with "tab stop" cells that are slightly-off-white and a dark cell border for the visual indicator of these cells. (In other themes, the grid BGs are non-white and cell BGs are sufficiently different, so no border is needed. But we may add the border to these anyway for additional distinction.)
Thanks!
On second thought. The gridline is drawn "between" cells. So 1 physical cell does not draw the entire gridline for itself. Only half, the other half is drawn by the left and top neighbor cell.
So, I guess your request does not really "fit" for VBFlexGrid and I am afraid to reject your request until a good idea approaches.
I checked with the vsFlexGrid and the CellBorder function is not respected by anything. (focus rect, combo button etc.) so it's just a "rectangle drawn over".
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Included the ColWordWrapOption/ColWordWrapOptionFixed run-time property.
This was an over-due feature missing from the MSHFlexGrid.
Now it is possible to overwrite per column from the default text formatting of the general WordWrap and SingleLine property.
Ok. Only two questions left. What is the difference between:
1. FlexWordBreakEndEllipsis and FlexWordBreakWordEllipsis.
2. FlexSingleLineEndEllipsis and FlexSingleLineWordEllipsis
Attachment 190455
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
Ok. Only two questions left. What is the difference between:
1. FlexWordBreakEndEllipsis and FlexWordBreakWordEllipsis.
2. FlexSingleLineEndEllipsis and FlexSingleLineWordEllipsis
Attachment 190455
The difference is that the one use DT_END_ELLIPSIS and the other DT_WORD_ELLIPSIS in the DrawText API.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
On second thought. The gridline is drawn "between" cells. So 1 physical cell does not draw the entire gridline for itself. Only half, the other half is drawn by the left and top neighbor cell.
So, I guess your request does not really "fit" for VBFlexGrid and I am afraid to reject your request until a good idea approaches.
I checked with the vsFlexGrid and the CellBorder function is not respected by anything. (focus rect, combo button etc.) so it's just a "rectangle drawn over".
Understood. I hope you won't mind me tossing ideas from time-to-time to see if it resonates...
One thought given the order of things was to consider this in a manner similar to the FlexComboCue*. I haven't dug into your code, but I assume that you are rendering the DropDown and Button images after the grids and cell BGs are established. Could this be something like a FlexCellCueBorder, where at the same time of rendering the Combo images a border could be drawn around the grid using a defined GridColorAlt?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Nouyana,
thanks however for bringing this up. It seems there is a bug.
If ComboItems is "" then a "blank" item is inserted.
So I will change the behavior in next release that if ComboItems is vbNullString (StrPtr() = 0) then really no item is inserted. However, if ComboItems is "" then a "blank" item shall still be inserted.
Is it still in your roadmap?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
Is it still in your roadmap?
That's already implemented.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
That's already implemented.
Yes, I can see now that ComboListCount = 0 when ComboItems is set to vbNullString. But what I noticed is an "empty" drop-down list which is still there, unlike the standard controls. Is it by design?
Code:
Private Sub VBFlexGrid1_ComboDropDown()
With VBFlexGrid1
Debug.Print .ComboListCount ' Returns 0.
End With
End Sub
Private Sub Command1_Click()
With VBFlexGrid1
.CellComboCue = FlexComboCueDropDown
.ComboMode = FlexComboModeDropDown
' .ComboItems = vbNullString ' I can see an "empty" drop-down list
End With
With cmbCombo1 ' VB ComboBox
.AddItem "Item"
.RemoveItem 0 ' There is no drop-down list.
End With
With cmbComboBoxW1 ' CCR ComboBox
.AddItem "Item"
.RemoveItem 0 ' There is no drop-down list.
End With
End Sub
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
20-Oct-2023
- Included enum FlexAlignmentGeneralTop/FlexAlignmentGeneralCenter/FlexAlignmentGeneralBottom.
The enum FlexAlignmentGeneral keeps valid and is the default column alignment value.
Am I understand right that there is no any difference between the FlexAlignmentGeneralCenter and FlexAlignmentGeneral constants?
And, by the way, Krool, may be you didn't know it because it's a bit undocumented. So, just as advice.
Code:
Private Enum MyEnum
[_enmFirst] = -1 ' You may keep the (-1) value here.
' This is just an invisible constant.
enm1 = 0
enm2 = 1
enm3 = 2 ' You may easy add a new constant here, but
[_enmLast] = 2 ' don't forget to update the last (invisible) constant.
End Enum
Public Property Let MyProperty(ByVal Value As MyEnum)
Select Case Value
Case [_enmFirst] To [_enmLast] ' You may use it instead of full enumeration.
Case Else
Err.Raise Number:=30005, Description:="Invalid Alignment value"
End Select
End Property
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
Yes, I can see now that
ComboListCount = 0 when
ComboItems is set to
vbNullString. But what I noticed is an "empty" drop-down list which is still there, unlike the standard controls. Is it by design?
Code:
Private Sub VBFlexGrid1_ComboDropDown()
With VBFlexGrid1
Debug.Print .ComboListCount ' Returns 0.
End With
End Sub
Private Sub Command1_Click()
With VBFlexGrid1
.CellComboCue = FlexComboCueDropDown
.ComboMode = FlexComboModeDropDown
' .ComboItems = vbNullString ' I can see an "empty" drop-down list
End With
With cmbCombo1 ' VB ComboBox
.AddItem "Item"
.RemoveItem 0 ' There is no drop-down list.
End With
With cmbComboBoxW1 ' CCR ComboBox
.AddItem "Item"
.RemoveItem 0 ' There is no drop-down list.
End With
End Sub
I don't understand. In all cases the drop-down list has no items. What's exactly the issue ?
What you mean by "no drop-down list" ? Of course there is a list shown when you push the dropdown button. Also in VB ComboBox.
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Of course there is a list shown when you push the dropdown button. Also in VB ComboBox.
Only in the VBCCR ComboBox
Code:
Private Sub cmdAddItems_Click()
With VBFlexGrid1
.CellComboCue = FlexComboCueDropDown
.ComboMode = FlexComboModeDropDown
.ComboItems = "Arnold|Bob|Charlie|David"
End With
With cmbCombo1 ' VB ComboBox, Style = 2 (Dropdown list)
.AddItem "Arnold"
.AddItem "Bob"
End With
With cmbComboBoxW1 ' CCR ComboBox, Style = 2 (Dropdown list)
.AddItem "Arnold"
.AddItem "Bob"
End With
End Sub
Private Sub cmdRemoveItems_Click()
VBFlexGrid1.ComboItems = vbNullString
cmbCombo1.Clear
cmbComboBoxW1.Clear
End Sub
Attachment 190487
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
I don't understand really how it works, but sometimes I can see the drop-down list in both comboboxes and sometimes I can't...
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Here I use the RemoveItem instead of Clear.
Code:
Private Sub cmdAddItems_Click()
With VBFlexGrid1
.CellComboCue = FlexComboCueDropDown
.ComboMode = FlexComboModeDropDown
.ComboItems = "Arnold|Bob|Charlie|David"
End With
With cmbCombo1 ' VB ComboBox, Style = 2 (Dropdown list)
.AddItem "Arnold"
End With
With cmbComboBoxW1 ' CCR ComboBox, Style = 2 (Dropdown list)
.AddItem "Arnold"
End With
End Sub
Private Sub cmdRemoveItems_Click()
VBFlexGrid1.ComboItems = vbNullString
cmbCombo1.RemoveItem 0
cmbComboBoxW1.RemoveItem 0
End Sub
Attachment 190488
-
2 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Set CellChecked to FlexTextAsCheckBox.
Process the EditKeyPress event and set KeyChar to 0 fur unwanted chars.
Code:
Private Sub Form_Load()
Set Me.VBFlexGrid1.DataSource = GetRs("SELECT * FROM tblDataTaye;")
With Me.VBFlexGrid1
.CellChecked = FlexTextAsCheckBox
End With
Set Me.VSFlexGrid1.DataSource = GetRs("SELECT * FROM tblDataTaye;")
End Sub
Attachment 190489
Hello Krool! I've set the ". CellChecked = FlexTextAsCheckBox", but you can't make the column of a Boolean field appear as the corresponding checkbox. The above is my code, please guide me on how to modify the code so that these Boolean fields (Boolean, Enabled, Allow, Delete) can be displayed according to the corresponding checkboxes of the field values. If you're convenient, add a demonstration of how to use the Boolean field display checkbox to this VBFlexGridDemo. Thank you very much!
Attachment 190490
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
smileyoufu
Code:
Private Sub Form_Load()
Set Me.VBFlexGrid1.DataSource = GetRs("SELECT * FROM tblDataTaye;")
With Me.VBFlexGrid1
.CellChecked = FlexTextAsCheckBox
End With
Set Me.VSFlexGrid1.DataSource = GetRs("SELECT * FROM tblDataTaye;")
End Sub
Attachment 190489
Hello Krool! I've set the ". CellChecked = FlexTextAsCheckBox", but you can't make the column of a Boolean field appear as the corresponding checkbox. The above is my code, please guide me on how to modify the code so that these Boolean fields (Boolean, Enabled, Allow, Delete) can be displayed according to the corresponding checkboxes of the field values. If you're convenient, add a demonstration of how to use the Boolean field display checkbox to this VBFlexGridDemo. Thank you very much!
Attachment 190490
Code:
Private Sub Form_Load()
Set Me.VBFlexGrid1.DataSource = GetRs("SELECT * FROM tblDataTaye;")
With Me.VBFlexGrid1
.FillStyle = FlexFillStyleRepeat
.Cell(FlexCellChecked, .FixedRows, 2, .Rows - 1, 5) = FlexTextAsCheckBox
End With
Set Me.VSFlexGrid1.DataSource = GetRs("SELECT * FROM tblDataTaye;")
End Sub
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Nouyana,
I can't replicate the "no drop-down list" thing. However, I fixed now a bug that the drop-down list is not clickable anymore when it's empty. So that the list will not be closed anymore and mouse capture is released.
The same behavior as a ComboBox..
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
I fixed now a bug that the drop-down list is not clickable anymore when it's empty.
Looks better. Thank you, Krool.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
Included the DragRow/DragCol function used to rearrange rows/cols by dragging the specified row/col with the mouse to a new position.
To note is that this is NOT an OLE drag/drop operation and the function will enter a modal message loop to just return the new moved position. (like vsFlexGrid)
The demo project is updated to use this new internal function.
Example code:
Code:
Private Sub VBFlexGrid1_BeforeMouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single, Cancel As Boolean)
With VBFlexGrid1
If Button = vbLeftButton And (Shift And vbAltMask) = vbAltMask Then
.HitTest X, Y
If .HitResult = FlexHitResultCell Then
If .HitCol < .FixedCols And .HitRow >= .FixedRows Then
VBFlexGrid1.RowPosition(.HitRow) = VBFlexGrid1.DragRow(.HitRow)
Cancel = True
ElseIf .HitCol >= .FixedCols And .HitRow < .FixedRows Then
VBFlexGrid1.ColPosition(.HitCol) = VBFlexGrid1.DragCol(.HitCol)
Cancel = True
End If
End If
End If
End With
End Sub
The OCX VBFLXGRD17 was also updated. The internal type lib version is now 1.6.
Code:
Object={2DA70529-3366-414A-B408-46083BCD481B}#1.6#0; VBFLXGRD17.OCX
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Included the DragRow/DragCol function
Great job, Krool! You make things easier!
I don't know why, but I can't unzip your new attachments. did you change the archiver? I use "7-zip" 24.01 (2024-01-31). I had to download files from Github.
Maybe something is wrong with this forum. The "Reply with quote" button doesn't work for me today too...
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
That seems to be a forum issue about the invalid zip file..
EDIT: zip file working again
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi Krool,
One question, with the combbox insert in a cell, dropdown is ok, leave the cell, it seems the combbox item already transfered to the cell, but when I use msgbox to read the cell text, it shows nothing! any idea or method about it?
Thanks.
John
PS: Sorry I use a timer to read the cell text and the above issue occured. Solved the problem.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
JT870,
please provide some code. Otherwise it's hard to imagine ..
Maybe you MsgBox the .EditText which of course is reset once editing is finished.
-
3 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi again!
When one column is a combobox column, and the list inside is wider than the column... it's possible to adjust the column before assigning one value?
i mean:
Before assigning a value:
Attachment 190579
Selecting it:
Attachment 190580
Selected:
Attachment 190581
It's possible to autoadjust the width of the column "before" selecting anyhing ?