Gui with many buttons, when a key is pressed with same initial alphabet, it should not launch, rather set focus !
Like Menus
A gui with 40 buttons, when you press an alphabet, if there is only single entry it should run button.
If there is more than one button starting with letter "s", the focus should shift to S, but not launch the first button.
is it possible ?
Thanks in advance for your help and support.
Gui with many buttons, when a key is pressed with same initial alphabet, it should not launch rather set focus,Lik Menu
-
- Posts: 313
- Joined: 23 Jan 2015, 01:49
- Micromegas
- Posts: 260
- Joined: 28 Apr 2015, 23:02
- Location: Germany
Re: Gui with many buttons, when a key is pressed with same initial alphabet, it should not launch rather set focus,Lik
If nobody replied it may be because other people are as confused by the question as I am. The way all good GUIs are designed is that they assign shortcut keys to their buttons, which don't necessarily have to be the initial of the button, to avoid that problem. If there are still any duplicates left, then there's still a way to address them with keys. E.g. under Windows the standard for that is to repeat entering the same key until the correct button (or other control, as the case may be) is selected, and then send space to select that one. Does that answer your question?
-
- Posts: 313
- Joined: 23 Jan 2015, 01:49
Re: Gui with many buttons, when a key is pressed with same initial alphabet, it should not launch rather set focus,Lik
Thanks for your time!
I tried this but it does not go to second button if i press it 2 OR more than 2 times.
Can you show me a way designing a GUI where if i press a key example N, and if there is more than 1 button whose name starts with N then, after pressing more than 1 time it should go to next button and as follows.
Thanks
I tried this but it does not go to second button if i press it 2 OR more than 2 times.
Can you show me a way designing a GUI where if i press a key example N, and if there is more than 1 button whose name starts with N then, after pressing more than 1 time it should go to next button and as follows.
Thanks
Code: Select all
Gui, Add, Button, G1, Nothing
Gui, Add, Button, G2, Nothing
Gui, Add, Button, G3, Nothing
Gui, Add, Button, G4, Nothing
Gui, Add, Button, G5, Nothing
Gui, Show
return
1:
MsgBox 1
return
2:
MsgBox 2
return
3:
MsgBox 3
return
4:
MsgBox 4
return
5:
MsgBox 5
return
Micromegas wrote:If nobody replied it may be because other people are as confused by the question as I am. The way all good GUIs are designed is that they assign shortcut keys to their buttons, which don't necessarily have to be the initial of the button, to avoid that problem. If there are still any duplicates left, then there's still a way to address them with keys. E.g. under Windows the standard for that is to repeat entering the same key until the correct button (or other control, as the case may be) is selected, and then send space to select that one. Does that answer your question?
- Micromegas
- Posts: 260
- Joined: 28 Apr 2015, 23:02
- Location: Germany
Re: Gui with many buttons, when a key is pressed with same initial alphabet, it should not launch rather set focus,Lik
Can't you just use an ampersand?
An ampersand (&) may be used in the name button to underline one of its letters. For example:In the example above, the letter P will be underlined, which allows the user to press Alt+P as shortcut key. To display a literal ampersand, specify two consecutive ampersands (&&).Code: Select all
Gui, Add, Button,, &Pause
Re: Gui with many buttons, when a key is pressed with same initial alphabet, it should not launch rather set focus,Lik
This is my suggestion:
Hubert
Code: Select all
n_s = 1
n_t = 5
o_s = 6
o_t = 7
f = 1
Gui, Add, Button, G1 default, Nothing
Gui, Add, Button, G2, Nothing
Gui, Add, Button, G3, Nothing
Gui, Add, Button, G4, Nothing
Gui, Add, Button, G5, Nothing
Gui, Add, Button, G6, Other
Gui, Add, Button, G7, Other
Gui, Show
return
1:
MsgBox 1
return
2:
MsgBox 2
return
3:
MsgBox 3
return
4:
MsgBox 4
return
5:
MsgBox 5
return
6:
MsgBox 6
return
7:
MsgBox 7
return
n::
o::
guicontrolget, f, focus
stringreplace, f, f, button
;msgbox, % f
guicontrol, -default, Button%f%
thk := a_thishotkey
xs = %thk%_s
xt = %thk%_t
x_s := %xs%
x_t := %xt%
;msgbox, % x_s " - " x_t
f++
if (f < x_s or f > x_t)
f := x_s
guicontrol, +default, Button%f%
guicontrol, focus, Button%f%
return
exitapp
escape::exitapp
-
- Posts: 313
- Joined: 23 Jan 2015, 01:49
Re: Gui with many buttons, when a key is pressed with same initial alphabet, it should not launch rather set focus,Lik
Truly Amazing, its working
Can i add more alphabets to
a::
b::
c:: AND SO ON...
n::
o::
x::
y::
z::
guicontrolget, f, focus
Thanks in advance for your help and support.
Can i add more alphabets to
a::
b::
c:: AND SO ON...
n::
o::
x::
y::
z::
guicontrolget, f, focus
Thanks in advance for your help and support.
hd0202 wrote:This is my suggestion:HubertCode: Select all
n_s = 1 n_t = 5 o_s = 6 o_t = 7 f = 1 Gui, Add, Button, G1 default, Nothing Gui, Add, Button, G2, Nothing Gui, Add, Button, G3, Nothing Gui, Add, Button, G4, Nothing Gui, Add, Button, G5, Nothing Gui, Add, Button, G6, Other Gui, Add, Button, G7, Other Gui, Show return 1: MsgBox 1 return 2: MsgBox 2 return 3: MsgBox 3 return 4: MsgBox 4 return 5: MsgBox 5 return 6: MsgBox 6 return 7: MsgBox 7 return n:: o:: guicontrolget, f, focus stringreplace, f, f, button ;msgbox, % f guicontrol, -default, Button%f% thk := a_thishotkey xs = %thk%_s xt = %thk%_t x_s := %xs% x_t := %xt% ;msgbox, % x_s " - " x_t f++ if (f < x_s or f > x_t) f := x_s guicontrol, +default, Button%f% guicontrol, focus, Button%f% return exitapp escape::exitapp
Who is online
Users browsing this forum: Google [Bot], Joey5 and 299 guests