Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form w/pageframe - return focus to form page from 2nd form
Message
From
20/09/2006 16:04:55
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Form w/pageframe - return focus to form page from 2nd form
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01155730
Message ID:
01155730
Views:
69
*** UPDATE ! ** DISREGARD **
The page.setfocus() started working - don't know what I did before, but it works now!

If I have form1 with a pageframe and the pageframe contains 10 pages. All pages except 2 have a grid on them. Each page on the pageframe has a hotkey assigned to it. On the bottom of form1 (not on the pageframe or any page but on the form itself) is a command button which calls form2. Focus is usually on any one of the pages on form1 when a command button is clicked which opens form2. Both forms are modeless. Form2 has no pageframe.

When form2 is released, I shift focus back to form1. If, when the commandbutton was clicked on form1 focus was on any page which contained a grid, when focus returns to form1 the hotkeys work to move from page to page. However, if focus was on one of the two pages on form1 which does not contain a grid (this is the only difference I can see offhand) when the command button to launch form2 is clicked, when form2 closes and focus switches back to form1, the correct page is active but the hotkeys on the pagetabs do not work until I mouseclick on the page or use the tabkey,etc. If I press any Alt-key combination before then, even though the form as focus, the alt keys activate the main window's menu instead of the page tabs.

I have tried placing a nonvisible grid on the two pages. I have tried initiating the page's activate, click, and even making a visible grid as a test. All to no avail. Any ideas?

If form2's queryunload, currently I have:
*form2.queryunload()
*set focus back to form1 and activate the page which had focus before form2 was launched
*we want to be able to use the hotkeys on the pagetabs to move from page to page if desired
*everything works fine except the hotkeys don't work if we return to those 2 pages from form2
*until we press tab or click on the page first - until then the main window menu is activated
        *--I chec and the window exists before I run the next line
	ACTIVATE WINDOW (this.poform) TOP     && this stores calling form form1.name
	IF TYPE('oFirehouse') = "O" .and. !ISNULL(oFireHouse) && public var for the form
	    IF PEMSTATUS(oFireHouse,'PageFrame',5)
                *--The activepage when cmdbutton on form1 was clicked which launched this form
		lnpageNumber = oFireHouse.PageFrame.ActivePage  && get the activepage
		DO CASE
		CASE lnpageNumber = 1
			oFireHouse.PageFrame.occupants.activate()
		CASE lnpageNumber = 2
			oFireHouse.PageFrame.Page2.activate()
		CASE lnpageNumber = 3
			oFireHouse.PageFrame.Page3.activate()
*NOTE:  Tried the page .setfocus(), .click(), etc

*etc
I even tried putting this.click() at the end of each page's activate to no avail. Any ideas? I know the form has the focus because if I tab I start tabbing through the pages correctly.

Form2 is launched from the command button on form1 via:
DO FORM oshydrnt NAME oOsHydrnt LINKED WITH thisform.name && pass the window to return to
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Next
Reply
Map
View

Click here to load this message in the networking platform