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 Thu 19 Oct 2017, 10:49
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
A text object to click to call any action... (Solved)
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [5 Posts]  
Author Message
LazY Puppy


Joined: 21 Nov 2014
Posts: 2007
Location: Germany

PostPosted: Wed 13 Apr 2016, 22:58    Post subject:  A text object to click to call any action... (Solved)
Subject description: ...is this possible?
 

Hi.

I want to have option to click an object in a gtkdialog gui to execute the default browser calling a specific website.

I know, I could use just a button and its <action></action> section.

But I would like to have just a text object to click, to execute the default browser calling a specific website.

Is this somehow possible by a text object or am I hooked to use <eventbox></eventbox> wrapping around the text object?

Thanks.

_________________
RSH

"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) Laughing

No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! Wink

Last edited by LazY Puppy on Thu 14 Apr 2016, 20:21; edited 1 time in total
Back to top
View user's profile Send private message 
Geoffrey


Joined: 30 May 2010
Posts: 2301
Location: Queensland

PostPosted: Wed 13 Apr 2016, 23:32    Post subject:  

I made a clickable text like this for my adobe flash updater.

Link markup text
Code:
LINK2="<b><u><span color='"'blue'"'>http://www.murga-linux.com/puppy/viewtopic.php?t=84267</span></u></b>"


Eventbox action
Code:
<eventbox tooltip-text="  Flash Player PETs Forum Thread " hover-selection="true" homogeneous="true">
<text wrap="false" justify="2" use-markup="true"><label>"'$LINK2'"</label></text>
    <action signal="button-press-event">defaultbrowser http://www.murga-linux.com/puppy/viewtopic.php?t=84267 &</action>
    </eventbox>

_________________
Carolina: Recent Repository Additions

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


Joined: 26 Jan 2011
Posts: 1366
Location: Japan

PostPosted: Thu 14 Apr 2016, 01:44    Post subject:  

Yes, it's possible if you set the selectable attribute. But it comes at a price: The mouse cursor will change to a beam cursor, which is kind of strange for a link, the text cursor will appear in the text when clicked and lastly you may want to make sure that the text doesn't get the focus at startup. All things considered an eventbox may be the better choice.
Code:
#!/bin/sh
LNK='http://www.murga-linux.com/puppy/viewtopic.php?p=836007#836007'

function  linkstyle { echo -en "<span underline='single' color='blue'>$1</span>" ;}
export -f linkstyle

echo -n '<vbox>
<hbox>
   <text>
      <label>"For more info about press events"</label>
   </text>
   <text selectable="true" use-markup="true">
      <input>linkstyle "click here"</input>
      <action signal="button-press-event">defaultbrowser '$LNK'</action>
   </text>
</hbox>
<button has-focus="true"></button>
</vbox>'|gtkdialog -s
Screenshot.png
 Description   
 Filesize   3.1 KB
 Viewed   237 Time(s)

Screenshot.png

Back to top
View user's profile Send private message 
LazY Puppy


Joined: 21 Nov 2014
Posts: 2007
Location: Germany

PostPosted: Thu 14 Apr 2016, 09:40    Post subject:  

Thanks for the replies.

I will build this wrapping the text object by eventbox.

_________________
RSH

"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) Laughing

No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! Wink
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 6492
Location: Valåmoen, Norway

PostPosted: Thu 14 Apr 2016, 12:21    Post subject:  

MochiMoppel wrote:
Yes, it's possible if you set the selectable attribute...
Code:

<text selectable="true" use-markup="true">
   <input>linkstyle "click here"</input>
   <action signal="button-press-event">defaultbrowser '$LNK'</action>
</text>
I didn't know. This thread has been added to our gtkdialog - tips and tricks
Thanks for sharing

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
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.0386s ][ Queries: 12 (0.0048s) ][ GZIP on ]