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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Confusion inside a Page on a Form 1

Status
Not open for further replies.

SitesMasstec

Programmer
Sep 26, 2010
508
Brasil
Hello collegues!

I am trying for hours to get focus in an object, but I have failed:
TelaPassageiros_brnibp.jpg


When I RightClick on Page1 I want the object cboOndeRepetir (please see upper right of the form) to get focus

When running the form and I right click on Page1, the following error appears:
ErroRightClick_htqvvf.jpg




Thank you,
SitesMasstec
 
USe intelllisense, that guides you.

The parent of a page is not the form, it's the pageframe object, the root object that has all the sibling pages. So you need one more Parent. This.Parent.Parent.

If you write [tt]This.parent[/tt] and then a dot, you'll only get page objects listed by intellisense. If you write [tt]This.parent.parent[/tt] and then a dot, you'll also see the combobox listed.

So even if you don't how many parent levels you need to go up, intellisense always guides you.

Chriss
 
Yes, Chris, I tried it also:
Code:
this.Parent.Parent.cboOndeRepetir.GotFocus
The first Parent is for Pageframe1 and the second Parent is for the main form, where the cboOndeRepetir resides.

In the case above, an error does NOT appear, but nothing happens (I mean, the cboOndeRepetir has not got focus)!

Thank you,
SitesMasstec
 
Well, I changed the Visible property of cboOndeRepetir to False and included the following code in the Page1, RightClick procedure:
Code:
this.Parent.Parent.CboOndeRepetir.Visible= .T.
this.Parent.Parent.CboOndeRepetir.GotFocus

And when I right click on Page1 the object cboOndeRepetir became visible! But does NOT got focus.



Thank you,
SitesMasstec
 
Oh, Chris, I am becoming old... SetFocus! Yes, GotFocus is when I click (or using Tab) on an object.
Now it works fine. Thanks.


Thank you,
SitesMasstec
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top