I'm real new to FireFly, but am beginning to try to use it. Perhaps I should have started with something simpler, as I'm not making too much progress, but am trying to get MSFlexGrid to work. I like that control and use it a lot in VB6. Anyway, I got a trial project started and running (it compiles and runs), but need to know how to interact with grid, set properties, respond to events, etc. For starters, how does one set the number of rows and columns. I tried this but it doesn't work (also tried it in %WM_PAINT event, it generates PB error):
Function FRMGRID_WM_CREATE (hWndForm As Dword, ByVal UserData As Long) As Long
Local vRows As Variant,vCols As Variant
vVols=5:vRows=10
Object Let DISPATCH_FRMGRID_GRDENTRY.Cols=vCols
Object Let DISPATCH_FRMGRID_GRDENTRY.Rows=vCols
End Function
Fred Harris
The general way to do it is as follows:
1. Start a new project.
2. Drop an OCX control in your form for the grid and resize it to the prefered proportions.
3. Activate the COM browser clicking the button in the OCX_ProgID property.
4. Double click MSFLXGRD.OCX ("Microsoft FlexGrid Control") and then double click the Version Independent ProgID ("MSFlexGridLib.MSFlexGrid").
5. Set the "IsLicensed" property to True.
6. Generate the events code module clicking the OCX_Events property and save it.
To respond to the events, double click Explorer->Modules->MSFlexGridLib1_Events.inc to load the module in the code editor, search the wanted event and put your code there.
For example, put MSGBOX "Click" in the MSFlexGridLibDMSFlexGridEvents1_Click function.
Hope this helps.
To change the number of rows and columns:
Function FRMGRID_WM_CREATE ( _
hWndForm As Dword, _ ' handle of Form
ByVal UserData As Long _ 'optional user defined Long value
) As Long
Local vRows As Variant,vCols As Variant
vCols=5:vRows=10
Object Let DISPATCH_FRMGRID_GRDENTRY.Cols=vCols
Object Let DISPATCH_FRMGRID_GRDENTRY.Rows=vRows
End Function
BTW post your questions in the FireFly Technical Assistance Forum. The Source Code forum is only to post examples and tutorials, not for discussions.
Thanks Jose for helping - you da'man when it comes to ocx/activex. :)
I have moved the topic as well....
Sorry about the MSFlexGrid question in the Source Code Forum. I won't let it happen again.
Was switching back and forth between the Source Code forum and my test FireFly ActiveX project when I sent the message without remembering to switch to technical. assistance.
Actually, it looks like I had the code right anyhow as when I deleted the whole FireFly project and went through the loading of an ActiveX project from scratch with a new test project it worked fine.
What appears to have happened is somehow some of the code for some functions in the ActiveX's events include file got mangled up. After I examined the PowerBasic compiler's error message close and found the scrambled up code I deleted the whole project rather than trying to fix the code.
I tried to duplicate the mangling with the new project but as of yet have not had it happen again. Perhaps it was just a fluke. If Paul or Hose want to see the error message from PB I'll send it. It does show the messed up function.
Loading and using ActiveX controls with FireFly does appear to be quite easy and I found the simple directions in the Help file to be good. Thanks Paul and Hose for the help.
Fred Harris