Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Accessing form properties via the forms collection
Message
From
28/12/1998 22:52:37
 
General information
Forum:
Visual FoxPro
Category:
Project manager
Miscellaneous
Thread ID:
00169827
Message ID:
00171041
Views:
63
I've tried 2 techniques for iteration of a form's members.
1) Attempt to obtain an object reference to a child form created by MODI FORM.
2) Attempt to obtain an array of members via ASELOBJ.

I've found that
A) I cannot get an object reference to the child window created by MODI FORM.
B) The KEYBOARD statement never selects any controls in the child window.

If I could obtain an object reference for the child form via some manipulation of WCHILD(parent, 0), then I'd be in hog heaven.
Any points or other tomfoolery?
- Brian

My experiments follow...
(sorry about the lack of indentation; the posting form strips leading spaces)

nFileCount = Application.ActiveProject.Files.Count
lcWindow = "parentWindow"

* Create a parent window
DEFINE WINDOW (lcWindow) NAME loWindow FROM 1,1 TO 50,50
loWindow.Caption = "Parent Window"
* Iterate through all files
FOR nn = 1 TO nFileCount

loForm = Application.ActiveProject.Files(nn)
* If an SCX form file

IF loForm.Type = FILETYPE_FORM AND !loForm.Exclude
* Attempt to open the form designer in the window
ACTIVATE WINDOW (lcWindow)
*! MODI FORM (loForm.Name) WINDOW (lcWindow) NOWAIT
MODI FORM (loForm.Name) IN WINDOW (lcWindow) NOWAIT
ln = AMEMBERS(laMem, loWindow, 1)
ASSERT !EMPTY(ln) MESSAGE "No members found"
* At this point, we have members belonging to the parent.
* But, we want the child members.

* Attempt to issue a Control-A (select all) in the form designer
ASSERT WOUTPUT(lcWindow) MESSAGE "Output not directed"
WAIT "" TIMEOUT 5
KEYBOARD '{CTRL+A}'
ln = ASELOBJ(laObj)
ASSERT !EMPTY(ln) MESSAGE "No controls selected"
* Again, this doesn't work. Probably because the parent (not the
* child) window is selected

DEACTIVATE WINDOW (lcWindow)

ENDIF
ENDFOR

RELEASE WINDOW (lcWindow)

RETURN

P.S. Again, my goal is to programmatically assign & maintain help IDs from a "builder". However, I want to process all of the forms WITHOUT user interaction, e.g. selecting all objects on a form.

P.P.S. I've considered manipulating the SCX.properties field. However, this appears complex, because certain containers (in my case, many containers) have COMBINED control properties listed directly in the properties field! For example, if a container contains a label and a textbox, the COMBINED properties from both the label and textbox appear in the container properties. This assumes that you have knowledge of baseclasses to parse the properties. Yuk
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform