Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 02 Sep 2014, 03:33
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How to use Focus and Enter keys? (Solved)
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [5 Posts]  
Author Message
arivas_2005

Joined: 25 Feb 2007
Posts: 89

PostPosted: 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
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: 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 Wink
focus.png
 Description   
 Filesize   55.95 KB
 Viewed   185 Time(s)

focus.png

Back to top
View user's profile Send private message 
SFR


Joined: 26 Oct 2011
Posts: 1063

PostPosted: 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. Wink

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
View user's profile Send private message 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: 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
View user's profile Send private message Visit poster's website 
arivas_2005

Joined: 25 Feb 2007
Posts: 89

PostPosted: Thu 02 May 2013, 14:22    Post subject:  

Solved my problem
Thanks and greetings !
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [5 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0605s ][ Queries: 13 (0.0042s) ][ GZIP on ]