-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
It's kinda hard to read the text in your screenshot but as far as I can distinguish you are calling "CreateWindowEx" and the last parameter is "ObjPtr(Me)" for some reason. MSDN says that parameter must be a pointer to window-creation data. Pretty sure you should put zero in there and it will work correctly.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi, thanks, if you click under "Found when it hangs:" i think the image will be open in another tab and bigger.
This code is nost mine, is in krool's project, I will try to use a zero on it, but if it's a bug, maybe krool can tell us more.
I will try it asap.
Thanks again !
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Tried.
Using Zero it hangs directly. :-(
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Maybe it fails on CreateWindowsEx because VBFlexGridWndClass failed to register previously?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
But it's too strange.... it works fine when i load the project the first time, then if i edit a form that has on it a grid, save it, and then if i start he project, when i open a form with a grid... hangs.
It's like when exiting the fist time, it's not releasing something (i can check if a have some previous version of the grid, i think this didn't happen, i will take a look and try it.).
the form i'm editing has 2 Grids on it, but it happens the same (i think) with a form with only 1 grid
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Exactly!
The problem is this code:
Code:
Public Sub FlexWndRegisterClass()
If (FlexClassAtom Or FlexRefCount) = 0 Then
Dim WCEX As WNDCLASSEX, ClassName As String
ClassName = "VBFlexGridWndClass"
With WCEX
.cbSize = LenB(WCEX) '48
' CS_VREDRAW and CS_HREDRAW will not be specified as entire redraw upon resize is not necessary.
.dwStyle = CS_DBLCLKS '8
.lpfnWndProc = ProcPtr(AddressOf FlexWindowProc) '38412116 ---- 38439988
.cbWndExtra = 4
.hInstance = App.hInstance '4194304 ------- 4194304
.hCursor = LoadCursor(0, IDC_ARROW) '65541 --------- 65541
.hbrBackground = 0
.lpszClassName = StrPtr(ClassName) '148822172 ---- 148357940
End With
FlexClassAtom = RegisterClassEx(WCEX) '-15529 --- 0 <---- i think this is the problem
If FlexSplitterBrush = 0 Then
I wrote the values of the first run (when everything works) in red.
And on it's right side, the ones from a second run (when it will hang)
It's not working the registerclassEx(wcex)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
MSDN says that: "All window classes that an application registers are unregistered when it terminates.". So this works correctly in a compiled EXE but in IDE you need to use "UnregisterClass" on "Form_Unload" if you want to start the app again without closing the IDE.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
The problem might be that UserControl_Terminate won't fire in the first run ? Can you confirm?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
It fires fine.
Maybe the problem is when i have 2 grids in the same form ? that it only fires one time ?
Let me check it
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
CONFIRMED!
If i modify a form that has 2 grids (when i say modify, i mean add any line of code, a comment is valid too), and save the project, then i start the project and load any form with a grid, it hangs.
Loading any form with a grid, not necessarily the one i modified, the project hangs.
It seems only unloads one grid, not the second one.
I think that, because if i modify a form with ONLY 1 grid on it, everything runs fine, no hangs at all.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Tried to fix It by myself, but... Lack of knowledge... :-(
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Calcu
Tried to fix It by myself, but... Lack of knowledge... :-(
Can you share a demo project isolating the problem?
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
I was creating a simple project (added) :
3 forms + your project , everything was fine... (strange)
And i just added 1 control (a control to show tabs on a MDI form), and it broken everything...
Added the project with the control... the tlb used with the control is who messed everything...
Let's see if you can identify the problem (looking to when the problem appeared.... i don't think it's on your code, but...)
Open my project
check the references, because i have the tlb on my system directory (added all the necessary at the zip file)
open 1 form
write anything on the code
save
you will see the grids grayed.
it will hang on open
Attachment 187254
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
In your project are some files missing to reproduce the error.
There are some classes that you need to make the RevMDITabs usercontrol run as a part of your project.
You could avoid this problem (and you did it halfway) by including the ocx to the components of your project INSTEAD of implementing the source for the control.
But if you do so you must include ALL parts of the OCX-source into you project (there is a BAS and three CLS not in your project).
So do as I did:
- remove the usercontrol from your MDIForm
- remove the component from the project
- add all parts of the usercontrol OCX to your project
- add the usercontrol from your project to your MDIform
Save the project and - enjoy
Greetings
I you do so (and I did), then there is no problem to edit you project or run it and fill the grids.
Greetings
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
I think i added all of them inside the project zip, just add them again when open the vbp, because i have them registered in another paths in my computer
Maybe i'm wrong ?
Edit 1:
you are right, i found the missing class (that's the problem when you create a project too fast..., sorry) 1 sec.
Edit2:
Checked twice, now it's complete.
Attachment 187258
can you test it ? you will know if it will hang, because the grid will be grayed when you push the save project button.
But.. there has to be something else, i have 2 diferents project without this control, and they are having the same problem.
Edit 3:
try this steps, i finally made it hung:
1.-open the project
2.- close all forms
3.- open form1
4.- click on save
5.- edit form_load (from form1), insert some comment : 'aaaaaa
6.- change to form view
7.- save again
8.- go to project - components - add microsoft windows common controls-2 6.0
9.- apply
you will see the grids grayed.
i think i can make a video
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
uploaded a video showing what it does.
If a run the project when the grid grayed out, it force closes the IDE
unzip the file and look at the video
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi all,
I think I found another bug.
I have a little sub to display a background color:
Code:
Public Sub Degradado(ElObjecto As Object)
Dim i As Single
Dim Y As Single
ElObjecto.DrawStyle = 6 '0
ElObjecto.DrawMode = 13 '13
ElObjecto.DrawWidth = 2 '1
ElObjecto.ScaleMode = 3 ' 1
ElObjecto.ScaleHeight = (256 * 2) '12150
For i = 255 To 0 Step -1
ElObjecto.Line (0, Y)-(ElObjecto.Width, Y + 2), RGB(i, i, i), BF
Y = Y + 2
Next i
End Sub
If i call it in the form_Resize event, the .hitrow of the grid is always returning -1. ¿?
If i comment scalemode and scaleheight from this sub, then the grid works as usual.
Ok, just using Scalemode = 3 in the form prop. it just doesn't work the .hitrow value
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Calcu
Hi all,
I think I found another bug.
I have a little sub to display a background color:
Code:
Public Sub Degradado(ElObjecto As Object)
Dim i As Single
Dim Y As Single
ElObjecto.DrawStyle = 6 '0
ElObjecto.DrawMode = 13 '13
ElObjecto.DrawWidth = 2 '1
ElObjecto.ScaleMode = 3 ' 1
ElObjecto.ScaleHeight = (256 * 2) '12150
For i = 255 To 0 Step -1
ElObjecto.Line (0, Y)-(ElObjecto.Width, Y + 2), RGB(i, i, i), BF
Y = Y + 2
Next i
End Sub
If i call it in the form_Resize event, the .hitrow of the grid is always returning -1. ¿?
If i comment scalemode and scaleheight from this sub, then the grid works as usual.
Ok, just using Scalemode = 3 in the form prop. it just doesn't work the .hitrow value
.HitRow just works if you do a .HitTest before. If you want a direct result of the current cursor position you can use .MouseRow.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
I tested it yesterday, it wasn't working
With Form in Twips:
Attachment 187263
It shows the row i clicked
Attachment 187262
If i change the form to Pixel:
Attachment 187264
The same code throw:
Attachment 187265
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Calcu
The flex grid wants always twips. (Like MSFlexGrid)
You can have a Form as pixels, you just need to use Form.ScaleXY to convert to twips.
So its not a bug but a feature.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Thanks!, understood.
Edit:
Have you been able to reproduce the other error?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
The new read-only properties ComboButtonWidth/ComboButtonClientWidth are helpful to use with button pictures.
If a button picture is too large it will be truncated. The height of the combo button is determined by the row height, but the width was fixed.
For drop-down button the width will continue to be fixed. So the new ColComboButtonWidth(i) property only is applicable for combo mode 3 - Button. (where only there a picture can be placed)
Below is a code example to make best-fit width of a certain picture.
Code:
Dim NonClientWidth As Long, Picture As IPictureDisp
NonClientWidth = VBFlexGrid1.ComboButtonWidth - VBFlexGrid1.ComboButtonClientWidth
Set Picture = Picture1.Picture
Set VBFlexGrid1.ColComboButtonPicture(1) = Picture
VBFlexGrid1.ColComboButtonWidth(1) = NonClientWidth + Me.ScaleX(CHimetricToPixel_X(Picture.Width), vbPixels, vbTwips)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi all, can anybody tell me what event must i use to detect that some text is pasted from the clipboard?
I'm pasting fine (control + v), but i can't detect a change or i don't know how to do it, i want to check what the user pasted and i can't detect when it was done...
Ideas?
Thanks!
Edit:
Solved this way, but i have to test it more:
In the Keydown event of the grid:
Code:
Private Sub Gr1_KeyDown(KeyCode As Integer, Shift As Integer)
' copiar: CTRL-C, CTRL-X, CTRL-INS
If KeyCode = vbKeyC And Shift = 2 Then Copiando = True
If KeyCode = vbKeyX And Shift = 2 Then Copiando = True
If KeyCode = vbKeyInsert And Shift = 2 Then Copiando = True
' pegar: CTRL-V, SHIFT-INS
If KeyCode = vbKeyV And Shift = 2 Then Pegando = True
If KeyCode = vbKeyInsert And Shift = 1 Then Pegando = True
End Sub
And then in the SelChangeEvent:
Code:
Private Sub Gr1_SelChange()
If Pegando Then
Gr1.AutoSize 0, 14, FlexAutoSizeModeColWidth, FlexAutoSizeScopeAll, False, 50
'more things to check
Pegando = False
End If
End Sub
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi Krool,
I'm trying to highlight a compete row when I select it. I can't seem to get column 0 to turn background blue like the rest of the columns in the row. What am I missing?
Is there a way to unselect the row with a mouse click?
I'm having great results using VB6 to create OCX forms and class libraries ScriptBasic can recieve event callbacks from and access the form OCX classes using it 'CallByName' COM extension module.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
ScriptBASIC
I'm having great results using VB6 to create OCX forms and class libraries ScriptBasic can recieve event callbacks from and access the form OCX classes using it 'CallByName' COM extension module.
sounds interesting.
Could you share your script language.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
ScriptBasic is an open source (MIT Common licensed) written in ANSI C. I have been maintaining the embeddable scripting engine since 2005. ScriptBasic runs on everything with unlimited expansion with it's C extension module API.
You can download ScriptBasic for Windows 32 bit install from HERE.
This is a screen shot of a current support time entry project I'm working on for a client. It uses ScriptBasic for base language and a VB6 OCX form / class COM DLL for the UI. I used ODBC to access both MS SQL and Sage 100 accounting software. I'm also using Sage 100's customer lookup via a BOI (Business Object Interface) without showing the Customer maintenance form which is done in ProvideX Business Basic.
https://www.vbforums.com/images/ieimages/2023/04/19.png
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
ScriptBASIC
ScriptBasic is an open source (MIT Common licensed) written in ANSI C. I have been maintaining the embeddable scripting engine since 2005. ScriptBasic runs on everything with unlimited expansion with it's C extension module API.
You can download ScriptBasic for Windows 32 bit install from
HERE.
interesting i will take a look
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
ScriptBASIC
Hi Krool,
I'm trying to highlight a compete row when I select it. I can't seem to get column 0 to turn background blue like the rest of the columns in the row. What am I missing?
Is there a way to unselect the row with a mouse click?
I'm having great results using VB6 to create OCX forms and class libraries ScriptBasic can recieve event callbacks from and access the form OCX classes using it 'CallByName' COM extension module.
Make .FocusRect = FlexFocusRectNone and .SelectionMode to either ByRow or FreeByRow.
If you then make .AllowMultiSelection = True you can unhighlight by ctrl+click.
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Krool,
Thanks for the reply. That didn't seem to work. I tried to disable multi-line select but that didn't work either.
Code:
TableGrid.FocusRect = FlexFocusRectNone
TableGrid.SelectionMode = FlexSelectionModeByRow
TableGrid.AllowMultiSelection = False
Attachment 187473
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
ScriptBASIC
Krool,
Thanks for the reply. That didn't seem to work. I tried to disable multi-line select but that didn't work either.
Code:
TableGrid.FocusRect = FlexFocusRectNone
TableGrid.SelectionMode = FlexSelectionModeByRow
TableGrid.AllowMultiSelection = False
Attachment 187473
Can you provide a demo? For me it worked..
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
I'll create a simple .exe form with just VBFLXGRD and zip up the source. Thanks for your help!
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Krool,
All of a sudden it started working correctly while working on a non-grid portion of the code. I think your code additions finally woke up. :)
https://www.vbforums.com/images/ieimages/2023/04/30.png
Thanks for the help getting this working!
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
OCX version 1.6 released.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi all!
I'm enjoying a lot this grid, thanks again Krool.
Just a question, when copying the data from the grid, and pasting it in a email, is there any option to paste the lines of the selected cells too ?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Update released.
AllowUserFreezing property now included.
Also the new AfterUserFreeze event fires after a user changed the number of frozen rows or columns.
Hi, Krool!
Can you tell us how can a user change the number of frozen rows or columns? I know how to do it by code (FrozenRows property), but it will not fire the AfterUserFreeze event. How does it work?
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
Hi, Krool!
Can you tell us how can a user change the number of frozen rows or columns? I know how to do it by code (FrozenRows property), but it will not fire the AfterUserFreeze event. How does it work?
Ensure that you have the AllowUserFreezing property set to True.
Below gif says more than words.
Attachment 187746
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Below gif says more than words.
Thank you very much!
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
For me it worked..
It works fine, but, in my opinion, the rectangle should not disappear when focus is changed to another control (unlike the MSFlexGrid).
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
I don't know what does it mean, but when I start the DEMO project (the last version) I give this error. The project is loaded and works fine.
WinXp SP3