Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to determine what 1st control on a page is or tabord
Message
 
To
13/05/2004 10:14:05
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00903578
Message ID:
00903583
Views:
14
Tracy, is control.TabIndex property of any help in your situation?

>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!
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform