| Author |
Message |
arivas_2005
Joined: 25 Feb 2007 Posts: 73
|
Posted: Wed 01 May 2013, 21:05 Post subject:
How to use Focus and Enter keys? (Solved) |
|
greetings
excuse my english
i have a little example in gtk
| Code: | #! /bin/bash
export DIALOG='
<window title="PERSONAL UNIT OR FOLDER" resizable="true" icon-name="computer">
<vbox>
<checkbox>
<variable>CHECKBOX</variable>
<label>FOLDER COMMON</label>
</checkbox>
<text use-markup="true" width-chars="40">
<label>INPUT PERSONAL UNIT</label>
</text>
<entry xalign="0.5" is-focus="true">
<default>User Input</default>
<variable>NAME1</variable>
<action signal="activate">command</action>
</entry>
<entry>
<default>Password Input</default>
<variable>NAME2</variable>
</entry>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
</window>
'
I=$IFS; IFS=""
for DECLARNAME in $(gtkdialog --center --program DIALOG); do
eval $DECLARARNOMBRE
done
IFS=$I
|
=============
How i can to pass focus of "User Input" to "Password Input" texbox using enter key?
or
fill textbox "User Input" and press [enter] then
... the focus should move to the second box, then newly I fill textbox "Passworod Input", then
I press to enter key.... pass the focus to button OK, and finally press to enter key for end
newlly, excuse my english.
(I used google traslate)
thanks
Last edited by arivas_2005 on Thu 02 May 2013, 14:21; edited 1 time in total
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1715 Location: Burghaslach, Germany
|
Posted: Thu 02 May 2013, 02:48 Post subject:
focus Subject description: TAB key |
|
I am afraid you cannot...
But old users (like me) are used to take the TAB key for jumping to next input field. That works
| Description |
|
| Filesize |
55.95 KB |
| Viewed |
88 Time(s) |

|
|
|
Back to top
|
|
 |
SFR

Joined: 26 Oct 2011 Posts: 571
|
Posted: Thu 02 May 2013, 06:19 Post subject:
|
|
Hmm, actually it's possible, but only in Gtkdialog >= 0.8.1:
| Code: | | <action signal="activate">grabfocus:NAME2</action> |
Ref.: http://code.google.com/p/gtkdialog/wiki/entry
However I'm accustomed to use TAB key as well.
Greetings!
_________________ [O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
|
|
Back to top
|
|
 |
thunor

Joined: 14 Oct 2010 Posts: 342 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Thu 02 May 2013, 13:13 Post subject:
|
|
| Code: | #! /bin/bash
export DIALOG='
<window title="PERSONAL UNIT OR FOLDER" resizable="true" icon-name="computer">
<vbox>
<checkbox>
<variable>CHECKBOX</variable>
<label>FOLDER COMMON</label>
</checkbox>
<text use-markup="true" width-chars="40">
<label>INPUT PERSONAL UNIT</label>
</text>
<entry xalign="0.5" is-focus="true">
<default>User Input</default>
<variable>NAME1</variable>
<action signal="activate">grabfocus:NAME2</action> #<<< Just as SFR stated above.
<action signal="activate">command</action>
</entry>
<entry activates-default="true"> #<<< This will activate the OK button on Enter.
<default>Password Input</default>
<variable>NAME2</variable>
</entry>
<hbox>
<button use-stock="true" label="gtk-ok" can-default="true" has-default="true"> #<<< Is now the default button.
</button>
<button cancel></button>
</hbox>
</vbox>
</window>
'
I=$IFS; IFS=""
for DECLARNAME in $(gtkdialog --center --program DIALOG); do
eval $DECLARARNOMBRE
done
IFS=$I |
Also be aware that you will be evaluating everything gtkdialog, gtk and any executed programs output with this command:
| Code: | | for DECLARNAME in $(gtkdialog --center --program DIALOG); do |
At the least you should change it to this:
| Code: | | for DECLARNAME in $(gtkdialog --center --program DIALOG 2>/dev/null); do |
although I quite like this:
| Code: | | for DECLARNAME in $(gtkdialog --center --program DIALOG | grep "^[A-Za-z0-9]*="); do |
because it additionally prevents evaluating anything sent to stdout by executed programs.
Anyway, you get the idea right.
Regards,
Thunor
P.S. Don't forget to remove the "#<<<" comments from the code above.
|
|
Back to top
|
|
 |
arivas_2005
Joined: 25 Feb 2007 Posts: 73
|
Posted: Thu 02 May 2013, 14:22 Post subject:
|
|
Solved my problem
Thanks and greetings !
|
|
Back to top
|
|
 |
|