Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to determine what 1st control on a page is or taborder
Message
From
13/05/2004 10:14:05
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
How to determine what 1st control on a page is or taborder
Miscellaneous
Thread ID:
00903578
Message ID:
00903578
Views:
66
I have many forms with multiple pages in a pageframe. About half of these are based on a class and the other half are not. In those that are not based on a class, I have the same code in every form's keypress:
*form keypress
CASE nKeyCode = 3  .and. nShiftAltCtrl = 0   && Page Down
   NODEFAULT
   IF THISFORM.PageFrame.ActivePage < THISFORM.PageFrame.PageCount
      THISFORM.PageFrame.ActivePage = THISFORM.PageFrame.ActivePage + 1
   ELSE
      THISFORM.PageFrame.ActivePage = 1
   ENDIF
   DO CASE
      CASE THISFORM.PageFrame.ActivePage = 1
      THISFORM.PageFrame.Page1.controltop.setfocus()
*etc

DO CASE
CASE nKeyCode = 18 .and. nShiftAltCtrl = 0  && Page Up
   IF THISFORM.PageFrame.ActivePage > 1
	THISFORM.PageFrame.ActivePage = THISFORM.PageFrame.ActivePage - 1
   ELSE
	THISFORM.PageFrame.ActivePage = THISFORM.PageFrame.PageCount
   ENDIF
   DO CASE
      CASE THISFORM.PageFrame.ActivePage = 1
 	THISFORM.PageFrame.Page1.controltop.setfocus()
*Etc

*page click and dblclick
DODEFAULT()
THIS.controltop.setfocus()
This works fine because I named the first control on every page 'controltop.' The last control on every page is named 'controlbottom' for the same reason. I also put code in each page's click and dblclick to set focus to the first control on the page so that when the user clicks on a pagetab, focus is on the first control on the page. This is important because F5 is used on most controls to run another popup form when editing detail for the item in the 1st control. If focus in on the pagetab and the user presses F5 (thinking they should be on the first control after clicking on the pagetab) then the default command button on the bottom of the form is clicked and the user is asked if they want to save and exit the form. All of this is working fine and I have no problems.

Here is the problem:

I need to implement the same functionality on the other set of forms which all are derived from the same form class. The other half of the forms based on a form class do not do this in anymeans so far. Each control on every page has a unique name. Since all forms are based on the class, I would like to be able to determine what the first control in the tab order on the page is so I can set focus to it in the keypress event of the form (as well as the page's click and dblclick) as in the example above. I would like to do this without having unique code in every form's keypress and every page's click and dblclick(). There are a LOT of forms that meet this condition.

All ideas appreciated!
.·*´¨)
.·`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