Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select first field on a page
Message
From
04/08/1999 08:04:04
Kenneth Downs
Secure Data Software, Inc.
New York, United States
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00249484
Message ID:
00249651
Views:
16
Gerard,

The basic answer of course is to subclass pages and build the desired behavior in, but it can't really be done (sigh) (explanation at bottom of this message).

The best I have come up with involves a few steps.

First, I have subclassed not the pages, but the pageframe itself. I then added methods to it such as "PageActivate", "PageDeactivate" etc.

From there you can add code to the individual page methods. Activate gets "This.parent.pageactivate(this)" and so forth. I've built myself a builder that automatically adds that code, but without the builder you have to add it to each page on each pageframe on each form.

From there I've added a property to all of my controls called "lFirstControl." I set this to TRUE on a form-by-form basis for the control I wish to have selected when the page is activated. The INIT of all of my controls has something like:
IF This.LFirstControl
  IF TYPE(this.parent.oFirstControl) = "U"
    this.parent.addproperty("oFirstControl",this)
  ELSE
    this.parent.oFirstControl = this
  ENDIF
ENDIF
My code for MyPageFrameClass.PageActive contains code like this (I'm doing this from memory):
LPARAM oPage
IF TYPE("oPage.oFirstControl") = "O"
  oPage.oFirstControl.SetFocus
ENDIF
FWIW, you can subclass a page, but IMHO it's not worth it. You have to build a form with the desired behavior, then do a DO FORM MyForm NAME oForm, then call oForm.PageFrame1.Page1.SaveAsClass(...) But you can't edit the class visually later on, and it turns out to be much more work than using the approach above.


>I have a form which has about 5 tabbed pages.
>I'd like to be able to start at page on, and when the last field is entered on page 1, go automatically to the forst fiels on page 2 etc...
>
>Anybody got any experience of doing this.
>
>
>One other thing.... I'm finding that I would like to set my own base classes up for Pages within a Page frame.. but I cant seem to be able to sub class the foxpro basec class fro a page.
>
>Any help appreciated.
>
>regards
>
>Gerard
Previous
Reply
Map
View

Click here to load this message in the networking platform