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 Fri 27 Mar 2015, 18:27
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
(Solved) What GtkDialog Code is the 'right one' ?
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [3 Posts]  
Author Message
LazY Puppy


Joined: 21 Nov 2014
Posts: 364
Location: Germany

PostPosted: Yesterday, at 18:45    Post subject:  (Solved) What GtkDialog Code is the 'right one' ?
Subject description: Keyboard problem in double quoted code
 

Hi.

There are two different ways I've seen and used to create a gtkdialog GUI code.

One method is to use doubled quotes (" code here ") which forces to use the the escape key ( \ ) a lot inside of the gtkdialog code.

Example 1:
Code:
"<window title=\"$APPTITLE $APPVERSION - $BNFSUBMIT\" icon-name=\"SFSHandler\" resizable=\"false\">
<vbox>
</vbox>
</window>"

Another method is to use single quotes (' code here ') which seems not to need any escape key at all.

Example 2:
Code:
'<window title="'${WIN_TITLE}'" icon-name="sfsplus" allow-grow="true" allow-shrink="false" resizable="true">
<vbox>
</vbox>
</window>'

Within the code of example 2 (single quotes) this code to exit the GUI by escape key is working fine.

Code:
<action signal="key-press-event" condition="command_is_true([ $KEY_SYM = Escape ] && echo true )">Exit:0</action>

Within the code of example 1 (double quotes) this code to exit the GUI by escape key is not working and closes the GUI immediately - no matter, what key was pressed.

Code:
<action signal=\"key-press-event\" condition=\"command_is_true\(\[ $KEY_SYM = Escape \] && echo true \)\">Exit:0</action>

Without the escape key inside the double quoted code, gtkdialog fails completely.

So how to change the code above to work properly ?

And what would the experts recommend to use (double or single quotes) ?

Thanks

_________________
RSH
No Smart-Phones, no FaceBook, no Twitter etc...
but: LazY Puppy!
Copyright is NOT Copyleft: good people are aware of this and respect both of them!

Last edited by LazY Puppy on Today, at 01:05; edited 1 time in total
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 623
Location: Japan

PostPosted: Today, at 00:10    Post subject: Re: What GtkDialog Code is the 'right one' ?
Subject description: Keyboard problem in double quoted code
 

LazY Puppy wrote:
So how to change the code above to work properly ?

This should work:
Code:
<action signal=\"key-press-event\" condition=\"command_is_true ([ \$KEY_SYM = Escape ] && echo true)\">Exit:0</action>

Quote:
And what would the experts recommend to use (double or single quotes) ?
I'm not an expert but I prefer single quotes. Easier to read and less hassle.
Back to top
View user's profile Send private message 
LazY Puppy


Joined: 21 Nov 2014
Posts: 364
Location: Germany

PostPosted: Today, at 01:05    Post subject: Re: What GtkDialog Code is the 'right one' ?
Subject description: Keyboard problem in double quoted code
 

MochiMoppel wrote:
This should work:
Code:
<action signal=\"key-press-event\" condition=\"command_is_true ([ \$KEY_SYM = Escape ] && echo true)\">Exit:0</action>

Yes, it works out of the box. Thanks. Smile

MochiMoppel wrote:
I'm not an expert but I prefer single quotes. Easier to read and less hassle.

Lately, after discovering possibility to use commented lines (##) in gtkdialog code,

Code:
export GDAM_GUI=$(echo "$GDAM_GUI" | sed 's/#[#~].*$//') # Strip comments
gtkdialog4 --class=GDAM_GUI -G $WIN_POS -p GDAM_GUI > /dev/null

in a script of yours, I had switched mainly to use single quotes also.

But I have lots of earlier scripts wherein I'd used doubled qoutes and I want to make some of them exiting when pressing the key "Esc" on the keyboard.

Now I can solve this, whenever I want to... Smile

Again, thanks.

_________________
RSH
No Smart-Phones, no FaceBook, no Twitter etc...
but: LazY Puppy!
Copyright is NOT Copyleft: good people are aware of this and respect both of them!
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [3 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.0525s ][ Queries: 11 (0.0037s) ][ GZIP on ]