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)
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)
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)
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)
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
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
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.
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
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)
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.
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)
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.
Last edited by ScriptBASIC; Apr 24th, 2023 at 02:12 AM.
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
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.
Last edited by ScriptBASIC; Apr 24th, 2023 at 03:05 PM.
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
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.
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
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.