Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Catch22 in When Event
Message
From
16/05/2002 02:12:09
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00656948
Message ID:
00657271
Views:
27
Gerard,
This is a 'rough' code - not all controls have tabindex, next might be Tabstop=.t. etc :
If !myTest1
  Nodefault
  local lnIndex, oControl
  lnIndex = this.Tabindex % thisform.controlcount + 1
  For each oControl in thisform.Controls
    If oControl.TabIndex = lnIndex
      oControl.Setfocus()
      Exit
    Endif
  Endfor
  oControl = .null.
Endif
Cetin

>Cetin, I've just been having another look at this:
>
>It seems if I issue a NODefault in the GotFocus event, without a Setfocus, focus goes to the FIRST object in the Tab Order on the screen.
>What I want to do is go to the NEXT object in the Tabindex, but without having to do an explicit MyObject.setfocus. i.e I always want it to go to whatever is the next object in the tabindex:
>
>Pseudo code would be:-
>
>GotFocus
>---------
>NoDefault
>NextTabindex = This.Tabindex + 1
>ObjectWhoseTabIndex=NextTabIndex.SetFocus
>
>Is there a way of finding the object which has a particular Tabindex
>
>The reason I want to do this is because I dont want to have to put in on every screen the actual object name. I want it to behave like the Return .f. on a when screen, i.e. it drops out of the currrent control and focus is set to whatever the next focus happens to be .
>
>Regards,
>
>Gerard
>
>
>
>
>
>
>
>
>
>
>
>>>Hi.
>>>I have a bunch of code in an old FPW app which I am trying to emulate in VFP
>>>
>>>Code goes as follows:
>>>When Event:
>>>Cmd1
>>>Cmd2
>>>cmd3
>>>If MyTest1 = .F.
>>> _Curobj=ObjNUm(MyNextField)
>>>Endif
>>>If Mytest2 = .F.
>>> Return
>>>Endif
>>>
>>>This works fine in FPW and the current control does not get focus if either Mytest1 or Mytest2 is false.
>>>
>>>If I try this in VFP When event (replacing _Curobj with a Set Focus,I get an error because this command is not allowed in the When event
>>>
>>>If I move the code to the GotFocus,the Return .f. does not leave the control
>>>
>>>Is there any way of leaving the above code in one of the controls(either GotFocus or When I guess) and getting the same result as a When in FPW.
>>>
>>>Regards,
>>>
>>>Gerard
>>
>>Gotfocus Event:
>>Cmd1
>>Cmd2
>>cmd3
>>If !MyTest1
>> nodefault
>> MyNextField.SetFocus()
>>Endif
>>If !Mytest2
>> Return && ???
>>Endif
>>
>>Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform