Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I programatically add objects to a PageFrame?
Message
From
27/07/2000 19:53:26
 
 
To
27/07/2000 19:14:59
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00397937
Message ID:
00397947
Views:
18
So you want something like this:
User picks "Customer Report" from the list.
Lower pageframe dynamically changes to show 2 pages:
page1 has search criteria - name, city, etc.
page2 has sorting/grouping criteria - name, zip, date, etc.

If you have a fairly static or slow growing list of reports, and you will have a lot of similar things to sort by, you could put them all on the pages of the pageframe and show or hide them (object.Visible = .T. or .F.) according to what was selected.

If you have a fairly dynamic list of reports and/or a wide range of uncommon criteria, you could drive it off a table or set of tables.
The parent table could have the basic report information - FRX name, display name, etc. This table could also be used to populate the listbox.
The child table could have the controls for the report - control name, control class, label caption, control order, etc.
When the selection is made, you would have to scan through the child table and add the controls to the appropriate pages with the Page.AddObject() or Page.NewObject() method.
The roughest part will be making sure the labels get lined up correctly with the controls and that the controls get lined up correctly on the form.
Here's a basic example - it assumes certain things that should be validated (e.g., the parameters are valid, tables are open, files exist, etc.)
but it's just here for an example

FUNCTION AddReportControls()
LPARAMETERS toObject, tcReportKey
LOCAL lcLabelName, lcCaption, lcClass, lcClassLib, lcName, ;
loLastObject

* report_main table is open
=SEEK(tcReportKey, "report_main", "ckey")
lcReportFile = report_main.creportfile
SELECT report_controls
** index ckey built on CKEY+STR(ITABORDER)
SET ORDER TO ckey
SET KEY TO tcReportKey
SCAN
lcLabelName = ALLTRIM(clabelname)
lcCaption = ALLTRIM(ccaption)

lcClass = ALLTRIM(cclass)
lcClassLib = ALLTRIM(cclasslib)
lcName = ALLTRIM(cname)

IF !EMPTY(lcLabelName)
toObject.AddObject(lcLabelName, "label")
toObject.&lcLabelName..Caption = lcCaption
ENDIF

IF !EMPTY(lcClassLib)
* custom class
toObject.NewObject(lcName, lcClass, lcClassLib)
ELSE
* base class
toObject.AddObject(lcName, lcClass)
ENDIF



ENDSCAN
Insanity: Doing the same thing over and over and expecting different results.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform