Page 1 of 1
Going to a field directly.
Posted: Mon Apr 14, 2014 7:23 am
by HunterEC
Guys:
I got a dialog that input different values in a range form:
Code: Select all
From To
Field 1 Label: [ get 1 ] [ get 2 ]
Field 2 Label: [ get 3 ] [ get 4 ]
Field 3 Label: [ ] [ ]
Field 4 Label: [ ] [ ]
Field 5 Label: [ ] [ ]
.
.
.
Field n Label: [ ] [ ]
How do I go to one of the 2 possible fields for each row with an accelerator key ?
Thank you very much.
Re: Going to a field directly.
Posted: Mon Apr 14, 2014 2:18 pm
by James Bott
Hunter,
I'm not clear on exactly what you want. If you just want to go to one of the two fields in the same row, then Tab or Shift-Tab will do it. But, I expect you already knew that.
If you are looking to be able to jump to any field from any other field, then you are looking at an awful lot of key combinations which I don't think would be very useful to the user.
So can you please explain in more detail what you want?
James
Re: Going to a field directly.
Posted: Tue Apr 15, 2014 6:31 pm
by HunterEC
James:
Thank for your reply. What I'm trying to do is to move to one of the two fields directly. the dialog consists of two column and 10 row field sets. If the user wants to go to field #2 in row 7 he presses an accelerator key to get to that field instead of pressing the tab key 13 times. I hope this explains more clearly what I'm trying to do. Thank you.
Re: Going to a field directly.
Posted: Wed Apr 16, 2014 1:42 pm
by James Bott
Hunter,
Well that is clear, but I wouldn't advise it. The user would have to memorize 20 key combinations, and I can't see that happening. The reason phone numbers are 7 digits long is due to a study a long time back that showed that 7 items was the most numbers that most people could memorize easily.
They can just hold the Tab or Shift-Tab down, to move through multiple fields, although it is very hard to stop on the field you want.
Why can't they just use the mouse?
James
Re: Going to a field directly.
Posted: Thu Apr 17, 2014 1:31 am
by HunterEC
James:
Thank you for your excellent answer !
Re: Going to a field directly.
Posted: Thu Apr 17, 2014 8:15 am
by Patrizio
Well, we can suppose the user know and remember the alphabet.
Hunter, you must use a say before every get with the accelerator key. A for Get1, B for Get2, etc.
Re: Going to a field directly.
Posted: Thu Apr 17, 2014 8:08 pm
by FranciscoA
Hi,
I just created this code. Maybe it's useful for you.
Please try it and let us know. (Example: CTRL + D = oGet[4])
Code: Select all
//---------------------------------------------------------
//IR A UN DETERMINADO GET (Francisco Alegria P. 17/04/2014)
//----------------------------
Function GoAnyGet()
local oDlg, aGet:=Array(10), oGet:=Array(10), n
local aLet := {"A","B","C","D","E","F","G","H","I","J"}, nPos
for n := 1 to len(aGet)
aGet[n] := "I'M NUMBER "+Str(n,2)
next
DEFINE DIALOG oDlg RESOURCE "BUSCADOR10"
REDEFINE GET oGet[1] VAR aGet[1] ID 201 OF oDlg
REDEFINE GET oGet[2] VAR aGet[2] ID 202 OF oDlg
REDEFINE GET oGet[3] VAR aGet[3] ID 203 OF oDlg
REDEFINE GET oGet[4] VAR aGet[4] ID 204 OF oDlg
REDEFINE GET oGet[5] VAR aGet[5] ID 205 OF oDlg
REDEFINE GET oGet[6] VAR aGet[6] ID 206 OF oDlg
REDEFINE GET oGet[7] VAR aGet[7] ID 207 OF oDlg
REDEFINE GET oGet[8] VAR aGet[8] ID 208 OF oDlg
REDEFINE GET oGet[9] VAR aGet[9] ID 209 OF oDlg
REDEFINE GET oGet[10] VAR aGet[10] ID 210 OF oDlg
REDEFINE BUTTON ID 313 OF oDlg ACTION oDlg:End() CANCEL
oDlg:bKeyDown := {|nKey| iif( (nPos := AScan(aLet,CHR(nKey))) != 0 ;
.and. GetKeyState(VK_CONTROL),;
oGet[nPos]:SetFocus(), ) }
ACTIVATE DIALOG oDlg CENTERED
RETURN NIL
Regards.