A text object to click to call any action... (Solved)

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
LazY Puppy
Posts: 1934
Joined: Fri 21 Nov 2014, 18:14
Location: Germany

A text object to click to call any action... (Solved)

#1 Post by LazY Puppy »

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.
Last edited by LazY Puppy on Fri 15 Apr 2016, 00:21, edited 1 time in total.
RSH

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

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

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#2 Post by Geoffrey »

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

Link markup text

Code: Select all

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

Code: Select all

<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> 
[b]Carolina:[/b] [url=http://smokey01.com/carolina/pages/recent-repo.html]Recent Repository Additions[/url]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#3 Post by MochiMoppel »

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: Select all

#!/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
Attachments
Screenshot.png
(3.1 KiB) Downloaded 359 times

User avatar
LazY Puppy
Posts: 1934
Joined: Fri 21 Nov 2014, 18:14
Location: Germany

#4 Post by LazY Puppy »

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) :lol:

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

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#5 Post by zigbert »

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

Code: Select all

<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

Post Reply