Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Building FoxyClasses LocatorGrid at runtime
Message
From
11/03/2017 06:05:54
 
 
To
10/03/2017 08:40:22
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01648879
Message ID:
01648936
Views:
91
Likes (1)
>>>Has anybody written code to create the FoxyClasses' LocatorGrid at runtime? I'm trying to do so and running into some issues. Wondering whether anyone has made this work?
>>>
>>>Tamar
>>
>>Yes, It is really straightforward, ie:
>>
>>
>>Public oForm
>>oForm = Createobject('sampleForm')
>>oForm.Show()
>>
>>Define Class sampleform As Form
>>	Height=600
>>	Width = 800
>>	Add Object myButton As CommandButton With Caption="Create Grid"
>>	Add Object myContainer As Container With Top=30,Height=770,Width=800, Anchor=15
>>
>>	Procedure myButton.Click
>>		Thisform.myContainer.Newobject("myLocator","locatorgrid", "d:\foxyclasses\classes\grids.vcx","",;
>>			"* from (_samples+'data\customer')")
>>		With Thisform.myContainer.myLocator
>>			.Height = Thisform.myContainer.Height
>>			.Width = Thisform.myContainer.Width
>>			.Anchor = 15
>>			.Visible = .T.
>>		Endwith
>>	Endproc
>>Enddefine
>>
>>
>
>Thanks. I'm doing it by adding the grid in the form's Init method (because I need to pass in the field list and other stuff). The grid came up, but it appears that something didn't work right. I don't get controls in the columns named "myHeader" and "myText", only the defaults. Here's the code I put in the grid subclass's Init:
>
>
>* Modified 9-March-2017 by TEG
>* Changing parameters, so we can build grid on the fly. 
>LPARAMETERS tcFieldList, tcTable
>*!*	Lparameters cSQL, cOrgSource
>IF PCOUNT() < 2
>	DO Error WITH "Cannot set up picklist without field list and table name"
>	RETURN .F.
>ELSE 
>	This.plFields = m.tcFieldList
>	This.cMainTable = m.tcTable
>ENDIF
>
>This.oFieldList = NEWOBJECT("colBase","picsbase.vcx")
>IF This.SetupGrid()
>
>	DODEFAULT('', '')
>	This.FormatGrid()
>	
>ELSE
>	RETURN .F.
>ENDIF 
>
>
>My custom SetupGrid method sets the cSQL property. Hmm, just hit me that I should probably pass .F. or omit the params in DODEFAULT. I'll try that.
>

Passing the right params to DODEFAULT() solved my immediate problem. Now working through the issues of adapting this to the existing application.

Tamar
Previous
Reply
Map
View

Click here to load this message in the networking platform