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

Program Flow in a PageFrame

Status
Not open for further replies.

Scott24x7

Programmer
Jul 12, 2001
2,826
JP
Hi all,
Sorry for the bombardment of questions, but I'm re-tooling my application to meet a lot of the best practices I'm seeing here, and as a result, I'm colliding into all kinds of things I've never seen before.
I've been working with a pageframe in one of my forms for a long time. It's the "core" of the application. But I just discovered a surprising behavior, that I find weird, but I also understand sort of WHY it happens, but not sure what the best method of managing it is.
My pageframe has 8 pages in it, and as I moved from one page to another, there some stuff that needs to happen (mostly related to grid setups). The surprise came when I discovered that the INIT of a page doesn't occur when the pageframe is being built... only for "Page 1". So when I click the tab for Page 2, it fires the Activate event, BUT without the INIT of the page ever happening, and there is setup there that I was expecting to have happen. I didn't want to put it in the Activate event, because that fires all the time when anything in the form brings attention back to the tab.

So the question is this: What is the best way to manage this? I thought the INIT was an event that just happened, and I would have expected it to happen automatically when I click on the tab with a sequence of INIT first, then Activate... but that is clearly not what is happening. I'm quite confused by this.


Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Init of all controls happens once with form innit. Activating a page doesn't init it, it already is inited, or it wouldn't be there to be activated. Pages have Activate/Deactivate happening.

Bye, Olaf.
 
Olaf,
That's odd though, because I put:

MESSAGEBOX("Now running page 2 init") in the page's init clause, and it never fires.

Shouldn't that messagebox appear then sometime when the form is loading?

Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."[hammer]
 
It works for me, there is no way around a control init. Since the messagebox even is blocking (modal) further program flow, it must be there.
Check, if you'r ereally starting the form you have put your code in.

Event order is page1 init, page2 init, pageframe init, then form init. It's always inside out.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top