Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PageFrame Page visible and setfocus 1

Status
Not open for further replies.

keepingbusy

Programmer
Apr 9, 2000
1,470
GB
Hi

I have a 2 page pageframe on a form. On that PageFrame is another PageFrame, also with 2 pages

On my form I have a command button with some commands that require the user to enter certain information before exiting the form (these are a couple of intials or a name showing who has updated the record).

What I am trying to achieve is if the user is on page 1 of PageFrame 1 and Page 2 of the second Pageframe (which is also called PageFrame1), I need the messagebox to show and once clicked Ok, Page 1 of the second PageFrame to be visible and focus set on the table field TxtUpdateby.

In my command button which by the way, is not on any of the PageFrames, I have the following:
Code:
IF LEN(TRIM(UPDATEBY))<2
  =MESSAGEBOX("Record updated by requires at least two initials"+ ;
    SPACE(10),0+48+0,"System Message")
*   THISFORM.PageFrame1.Page1.PageFrame1.Page1.ActivePage=1
   THISFORM.PageFrame1.Page1.PageFrame1.Page1.TxtUpdateby.SetFocus()
  RETURN 0
ENDIF
I hope that makes sense and any guidance would be appreciated.

Thank you

Lee

Visual FoxPro Version 9
 
Lee,

Instead of this:

Code:
THISFORM.PageFrame1.Page1.PageFrame1.Page1.ActivePage=1

you need this:

Code:
THISFORM.PageFrame1.Page1.PageFrame1.ActivePage=1

ActivePage is a property of the pageframe, not the page.

Apart from that, your code looks OK, as far as I can see.

By the way, this is a good argument for giving your controls meaningful names (as I'm sure you agree).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Hi Mike

Thank you for the reply. I'm out of the office so I'll try this amendment later. I agree with your comments about Control names, sometimes VFP9 makes things too easy when it comes to auto complete.

I'll post back with result later on

Many thanks as always

Lee

Visual FoxPro Version 9
 
Hi Mike
As you suggested I updated the original code and now have the following:
Code:
IF LEN(TRIM(UPDATEBY))<2
  =MESSAGEBOX("Record updated by requires at least two initials"+ ;
    SPACE(10),0+48+0,"System Message")
  [b]THISFORM.PageFrame1.Page1.PageFrame1.ActivePage=1[/b]
  THISFORM.PageFrame1.Page1.PageFrame1.Page1.TxtUpdateby.SetFocus()
  RETURN 0
ENDIF
This has resolved the issue.

Thanks again Mike

Lee

Visual FoxPro Version 9
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top