GtkDialog - tips

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
CatDude
Posts: 1563
Joined: Wed 03 Jan 2007, 17:49
Location: UK

#1246 Post by CatDude »

vovchik wrote:Dear Lobster,

The linux version of growl (notification) program is here: https://github.com/mattn/growl-for-linux. There is source there, so I will download it and see whether/how it compiles on my PI3 and post some results here.

With kind regards,
vovchik
Hi

I think Lobster may be after the gtkdialog4 sources.
They are available here: https://github.com/01micko/gtkdialog
not sure if there are newer ones elsewhere though.

CatDude
.
[img]http://www.smokey01.com/CatDude/.temp/sigs/acer-futile.gif[/img]

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#1247 Post by Lobster »

Thanks Vovchik and CatDude :D

Will see how Vovchik gets on and then hopefully have a compiled deb?

I would compile it myself but am not great at compiling. Mind you there is a very nice set of demos on the raspberry pi website ... if it is just "make-c gtkdialog.h" I might be able to manage it . . .
https://projects.raspberrypi.org/en/pro ... o-programs

Meanwhile I am off to find The Blazing World ...
https://en.wikipedia.org/wiki/The_Blazing_World
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#1248 Post by don570 »

BarryK wrote: There is a problem with window resizing, after doing a "show" then a "hide" again (with a "hide" button) -- the window stays bigger, with a gap in it.
I would try putting various widgets ---> text , hbox, hidden buttons
with space-expand="true" space-fill="true" directive to see if that
will change behaviour of gtkdialog resizing

<hbox space-expand="true" space-fill="true">


<text space-expand="true" space-fill="true">
<label>""</label>

_____________________________________________

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#1249 Post by vovchik »

Dear Lobster,

I managed to compile and install that growl in Tahr, but RP3 is proving more difficult. The problem is that the header files for openssl in the Raspbian repository (dev files) do not correspond with the biniaries installed. I am afraid I might bork my PI if I install the "recommended" fix to this problem and am still thinking of how to install the headers so that pkg-config knows about them and does not complain. I will get it to work eventually, I hope. I am not the first person to run into this problem....

With kind regards,
vovchik

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#1250 Post by BarryK »

I'm an occasional user of gtkdialog, have a burst of activity, then leave it for sometime. So I never really get in deep, but I am now trying to learn more.

And, I have just hit something that is contrary to my understanding up until now.

If you have some radiobutton, say:

Code: Select all

<frame Radiobutton example>
	<radiobutton>
		<label>Radiobutton1</label>
		<action>echo Radiobutton1 is clicked.</action>
	</radiobutton>
	<radiobutton>
		<label>Radiobutton2</label>
		<action>echo Radiobutton2 is clicked.</action>
	</radiobutton>
	<radiobutton>
		<label>Radiobutton3</label>
		<action>echo Radiobutton3 is clicked.</action>
	</radiobutton>
</frame>
I always assumed that an action would execute if the radiobutton was clicked on. Yes, but the previously-selected radio button also fires it action.

So, initially Radiobutton1 is selected, then I click on Radiobutton2, and I get two echo messages:

Code: Select all

Radiobutton1 is clicked.
Radiobutton2 is clicked.
I think that I have written some broken code in the past, because I didn't understand this.

To me, the default behaviour should be that only the clicked-on button fires its action. Anyway, how to fix this so that it does work as I want?

Well, this does fix it:

Code: Select all

<frame Radiobutton example>
	<radiobutton>
		<label>Radiobutton1</label>
		<action signal="button-release-event">echo Radiobutton1 is clicked.</action>
		<action signal="button-release-event">echo DITTO Radiobutton1 is clicked.</action>
	</radiobutton>
	<radiobutton>
		<label>Radiobutton2</label>
		<action signal="button-release-event">echo Radiobutton2 is clicked.</action>
		<action signal="button-release-event">echo DITTO Radiobutton2 is clicked.</action>
	</radiobutton>
	<radiobutton>
		<label>Radiobutton3</label>
		<action signal="button-release-event">echo Radiobutton3 is clicked.</action>
		<action signal="button-release-event">echo DITTO Radiobutton3 is clicked.</action>
	</radiobutton>
</frame>
Now, if I click Radiobutton2, just get this:

Code: Select all

Radiobutton2 is clicked.
DITTO Radiobutton2 is clicked.
But, is there any other more proper way to do it?
[url]https://bkhome.org/news/[/url]

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#1251 Post by BarryK »

This also works;

Code: Select all

<frame Radiobutton example>
	<radiobutton>
		<label>Radiobutton1</label>
		<variable>RAD1</variable>
		<action>if true echo Radiobutton1 is clicked.</action>
		<action>if true echo DITTO Radiobutton1 is clicked.</action>
	</radiobutton>
	<radiobutton>
		<label>Radiobutton2</label>
		<action>if true echo Radiobutton2 is clicked.</action>
		<action>if true echo DITTO Radiobutton2 is clicked.</action>
		<action>if true hide:RAD1</action>
	</radiobutton>
	<radiobutton>
		<label>Radiobutton3</label>
		<action>if true echo Radiobutton3 is clicked.</action>
		<action>if true echo DITTO Radiobutton3 is clicked.</action>
	</radiobutton>
</frame>
I stuck in this extra line:

Code: Select all

<action>if true hide:RAD1</action>
The problem is though, if I have this form:

Code: Select all

<action function="hide">RAD1</action>
...where do I put the "if true" logic?
[url]https://bkhome.org/news/[/url]

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

#1252 Post by MochiMoppel »

BarryK wrote:But, is there any other more proper way to do it?
What you need to know is that the default <action> of a radiobutton widget fires upon a "toggled" signal. So when you select Radiobutton2, Radiobutton2 is toggled from "false" state to "true" and at the same time Radiobutton1 is toggled from an initial "true" to "false", hence the <action>s of both radiobuttons are triggered. This would do what you intended:

Code: Select all

<frame Radiobutton example> 
    <radiobutton> 
       <label>Radiobutton1</label> 
       <action>if true echo Radiobutton1 is clicked.</action> 
    </radiobutton> 
    <radiobutton> 
       <label>Radiobutton2</label> 
       <action>if true echo Radiobutton2 is clicked.</action> 
    </radiobutton> 
    <radiobutton> 
       <label>Radiobutton3</label> 
       <action>if true echo Radiobutton3 is clicked.</action> 
    </radiobutton> 
 </frame>
Last edited by MochiMoppel on Fri 26 Jan 2018, 13:38, edited 1 time in total.

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

#1253 Post by MochiMoppel »

Removed.

I thought that RAD1 is a separate widget that you want to hide. Now I realize that it's the first radiobutton. I'm not sure if I understand the purpose. You want to hide the first radiobutton by clicking the second?
...where do I put the "if true" logic?
Nowhere.
It seems that with this syntax the function is executed only when the status is "true". Your code

Code: Select all

<action function="hide">RAD1</action>
should work as intended.

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#1254 Post by BarryK »

MochiMoppel wrote:Removed.

I thought that RAD1 is a separate widget that you want to hide. Now I realize that it's the first radiobutton. I'm not sure if I understand the purpose. You want to hide the first radiobutton by clicking the second?
...where do I put the "if true" logic?
Nowhere.
It seems that with this syntax the function is executed only when the status is "true". Your code

Code: Select all

<action function="hide">RAD1</action>
should work as intended.
Thanks for responding.

There was no purpose in hiding the first radiobutton. "RAD1" could be anything.

The problem remains. As you say,

Code: Select all

<action function="hide">RAD1</action>
will fire on a toggle of state, but I only want it to fire when the state changes to true.

So, the question is, how do I put in the equivalent logic for "if true" for

Code: Select all

<action function="hide">RAD1</action>
My previous example may have been unclear, so here it is again, to illustrate the problem:

Code: Select all

<text><label>this is a label</label><variable>VAR1</variable></text>
<frame Radiobutton example>
	<radiobutton>
		<label>Radiobutton1</label>
		<variable>RAD1</variable>
		<action>if true echo Radiobutton1 is clicked.</action>
		<action>if true echo DITTO Radiobutton1 is clicked.</action>
		<action function="hide">VAR1</action>
	</radiobutton>
	<radiobutton>
		<label>Radiobutton2</label>
		<variable>RAD2</variable>
		<action>if true echo Radiobutton2 is clicked.</action>
		<action>if true echo DITTO Radiobutton2 is clicked.</action>
	</radiobutton>
	<radiobutton>
		<label>Radiobutton3</label>
		<action>if true echo Radiobutton3 is clicked.</action>
		<action>if true echo DITTO Radiobutton3 is clicked.</action>
	</radiobutton>
</frame>
Initially, Radiobutton1 is selected. If I click on Radiobutton2, then the text label becomes hidden. NOT what I want!

EDIT:
In Thunar's documentation for the radiobutton, he has stated this:
This widget's actions can be conditionally executed (based upon its active state) by prepending its contents with if true or if false although 0.8.3 introduced a dedicated condition attribute which may be more suitable.
However, I cannot find anywhere how it can be done with the condition attribute.

EDIT2
Got it! Had to search outside the Puppy Forum, found the answer here:

https://github.com/oshazard/gtkdialog/b ... eous/break

This is the correct syntax:

Code: Select all

		<action function="hide" condition="active_is_true(RAD1)">VAR1</action>
Yay, it works!
[url]https://bkhome.org/news/[/url]

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#1255 Post by BarryK »

continuing from above, I ran into another problem...

In the app I am working on, I have a radiobutton action that already has a condition. Not the same as this, this is just for illustration:

Code: Select all

	<action function="hide" condition="command_is_true(echo true)">VAR1</action>
So how to put in the test for the radiobutton being true? Any way to "and" the condition test?

Dunno, but I did this, it worked:

Code: Select all

	<action signal="button-release-event" function="hide" condition="command_is_true(echo true)">VAR1</action>
[url]https://bkhome.org/news/[/url]

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#1256 Post by BarryK »

Aaargh, here is something that caught me by surprise.

I naively assumed that multiple actions in a widget execute in their order of placement. Not always so!

Code: Select all

	<radiobutton>
		<label>Radiobutton1</label>
		<variable>RAD1</variable>
		<action>if true echo True1 Radiobutton1</action>
		<action>if true echo True2 Radiobutton1</action>
		<action condition="active_is_true(RAD1)">echo True3 Radiobutton1</action>
		<action signal="button-release-event">echo True4 Radiobutton1</action>
		<action signal="button-release-event">echo True5 Radiobutton1</action>
	</radiobutton>
Output:

Code: Select all

True4 Radiobutton1
True5 Radiobutton1
True1 Radiobutton1
True2 Radiobutton1
True3 Radiobutton1
I suppose that I can see the logic of it. A button release occurs, the actions are evaluated. Then, radiobutton changes state, the actions are evaluated again.
[url]https://bkhome.org/news/[/url]

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

#1257 Post by MochiMoppel »

BarryK wrote:I was pretty sure that multiple actions in a widget execute in their order of placement
They do, but these have to be multiple actions for the same signal.
All actions for the signal "button-release-event" are performed consecutively, and all actions for the (default) signal "toggled" are also performed consecutively. Which signal's actions are executed first depends on the signal, but as I mentioned here the "custom actions" are executed first and the "default actions" (means actions for which you don't need to explicitly specify a signal because a default signal has been defined, here the "toggled") are executed last. Looking at your example you see that this rule applies.

As for your preceding posts: I'll let it settle as you eventually find the answers to your own questions. You'll see that the "if true" and "if false" constructs are more useful than you think and that button signals for radio buttons seldom need to be taken care of.

.
Last edited by MochiMoppel on Sat 27 Jan 2018, 12:54, edited 1 time in total.

User avatar
KuLuSz
Posts: 31
Joined: Wed 13 Dec 2017, 18:07
Location: HuNgArY
Contact:

#1258 Post by KuLuSz »

"i have a dream" where gtkdialog used like a desktop environment ... any ideas or possiblity solutions ? I think the gtk desklets is good stuff for clone more big DEs,same like gtk3 in ubuntu main distro ... but i not want use gtk3 just 2. :) i was look gtkbased DE thats the GPE environment , i was try install it , but need matchbox environment for managing windows , but when i try start its said not found display ... i try any display but cant start . Librarys are ok ...
Last edited by KuLuSz on Sat 27 Jan 2018, 12:42, edited 1 time in total.
[size=200][b]<(] [color=red]K u L u S z[/color] [)>[/b][/size]
Live contact: [url=https://discord.gg/74tBqJk]DISCORD[/url] [url=http://webchat.freenode.net/?nick=Mess2KuLuSz...&channels=puppylinux&prompt=1]IRC[/url]

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#1259 Post by Lobster »

vovchik wrote:Dear Lobster,

I managed to compile and install that growl in Tahr, but RP3 is proving more difficult. The problem is that the header files for openssl in the Raspbian repository (dev files) do not correspond with the biniaries installed. I am afraid I might bork my PI if I install the "recommended" fix to this problem and am still thinking of how to install the headers so that pkg-config knows about them and does not complain. I will get it to work eventually, I hope. I am not the first person to run into this problem....

With kind regards,
vovchik
Thanks Vovchik

I am happy to await your efforts. The RP3 is a great device. Really appreciate your efforts. :D

Lobster
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
mister_electronico
Posts: 969
Joined: Sun 20 Jan 2008, 20:20
Location: Asturias_ España
Contact:

Something that I just see now

#1260 Post by mister_electronico »

I was looking as put icons into a "tree" from a text file then it occurred to me this script. Sure there is other ways of doi it.
Anyway can be useful to someone.

Code: Select all

#! /bin/bash

echo "hello" > /tmp/tmp235
echo "nice" >> /tmp/tmp235
echo "to_meet_you" >> /tmp/tmp235

export MAIN_DIALOG='
<vbox>

  <frame prueba> 
     <tree hover_expand="true" hover_selection="true">
      <label>Device</label>
    
    '` N=0 ;for line in $(cat /tmp/tmp235);do
       echo ' <item stock="gtk-apply">"'$line'"</item>'
        done   `'   
      <height>100</height><width>400</width>
      <variable>TREE</variable>  
       </tree>  
  </frame>
  <hbox>
    <button cancel></button>
    <button ok></button>
  </hbox>
</vbox>
'

gtkdialog --program=MAIN_DIALOG



greetings.

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

Re: Something that I just see now

#1261 Post by MochiMoppel »

mister_electronico wrote: <tree hover_expand="true" hover_selection="true">
hover_expand ? Since row expansion is not implemented in gtkdialog this should have no effect whatsoever. Does it work for you somehow?

User avatar
mister_electronico
Posts: 969
Joined: Sun 20 Jan 2008, 20:20
Location: Asturias_ España
Contact:

HI

#1262 Post by mister_electronico »

Sorry MochiMoppel ,I was looking for play around with different things and I forget to delete it.

It makes No sense, I was looking for how to put icons in the items when they come from a file.

Sorry

See you.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#1263 Post by technosaurus »

In case anyone is interested in adding some graphics to bash scripts:
https://developers.slashdot.org/story/1 ... s-for-bash
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
Keef
Posts: 987
Joined: Thu 20 Dec 2007, 22:12
Location: Staffordshire

#1264 Post by Keef »

...and it works too. Not that I have the slightest idea what to do with it, but I can always stare at the demos.
It compiles on Quirky Xerus64 with just the addition of ftgl (from PPM). Also compiled on Slacko 571 (Sailor's recent offering) and also got ftgl from PPM. Other dependencies may be needed depending on your distro.
Attachments
CmdlineGL.jpg
(19.68 KiB) Downloaded 426 times
CmdlineGL-2.jpg
(15.63 KiB) Downloaded 431 times

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#1265 Post by wiak »

Keef wrote:...and it works too. Not that I have the slightest idea what to do with it, but I can always stare at the demos.
You seem to be one of the few people that actually tests anything new Keef (at least that's the impression I sometimes get)! I had a look at the bash/opengl thing too, but opengl games type programming isn't of much use to me personally, and it seems to be a pretty straight binding from bash to opengl so main job would be learning opengl programming anyway, which I'm not likely to do. Wasn't sure why it was posted under GtkDialog tips - hoped it was an alternative bash to gtk widget kind of toolkit, but it isn't as far as I can see. I suppose was posted here because it is driven from bash, like gtkdialog is, so that would explain it.

wiak

Post Reply