Gtkdialog Development

Under development: PCMCIA, wireless, etc.
Message
Author
disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#161 Post by disciple »

Wouldn't a checkbox normally be used in that situation?
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#162 Post by 8-bit »

disciple,
If you have the latest version of gtkdialog from thunor and have ran the spinbutton example, you might get more insight as to what I am saying.

I update gtkdialog3 with thunor's latest each time he shows us a new example as often an update of gtkdialog3 is needed to have the example work properly.

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

#163 Post by zigbert »

I thought I saw an example of moving items inside a <tree> widget. I am talking about my example in the tips-thread. Thunor (I think) showed how it could be done by using gtk-options. Do you know where to find this?


Thank you
Sigmund

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#164 Post by disciple »

Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

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

#165 Post by zigbert »

Damn it, how hard can it be to write correct. I have to repeat myself:

I thought I saw an example of moving items inside a <tree> widget. I am NOT talking about my example in the tips-thread. Thunor (I think) showed how it could be done by using gtk-options. Do you know where to find this?


:D Sigmund

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#166 Post by disciple »

Maybe there's something I'm missing about what you're asking, but Argolance's example I linked to is for a tree widget. Argolance was looking for help because it had a problem if you clicked on an item and didn't drag it, and 8-bit posted a link to a workaround for that problem using getcurpos http://www.murga-linux.com/puppy/viewto ... 651#549651
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#167 Post by disciple »

Ah, sorry - you haven't edited your last post, have you?
I thought you said you were not talking about your example of moving items in a list widget. But you didn't say that - I must have imagined it.
disciple wrote:Maybe there's something I'm missing about what you're asking
I think I was missing this bit:
zigbert wrote:using gtk-options
8-bit's example does not use gtk-options. Unless I'm misunderstanding what "gtk-options" means, of course.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#168 Post by thunor »

zigbert wrote:...moving items inside a <tree> widget...using gtk-options.
The GTK+ property is "reorderable".

Regards,
Thunor

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#169 Post by seaside »

Ah yes, "reorderable".

I think this operation needs a tooltip to go with it. I remember struggling with trying to move an item up and down a list and constantly ending up with placing it as a subheading instead.

The trick is after highlighting an item, drag it to the right and keeping the mouse button down move the item up and down and watch for a line under the item where you wish it placed.

Regards,
s

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#170 Post by thunor »

seaside wrote:I remember struggling with trying to move an item up and down a list and constantly ending up with placing it as a subheading instead.
Hi seaside

I researched this a while back and I couldn't stop the branches from appearing when dragging-and-dropping onto existing rows. What I discovered was that Gtkdialog's tree widget is a GtkTreeView using the GtkTreeStore model which is "a tree-like data structure", whereas -- I'm assuming as I haven't tested it yet -- a GtkTreeView using the GtkListStore model implementing "a list-like data structure" may have been more appropriate. Maybe there was a reason why the tree-like structure was chosen over the list-like structure.

Regards,
Thunor

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#171 Post by thunor »

Added timer widget

The widget reference is available here.
  • The default signal is "tick", emitted when the timer ticks.
  • The default precision is seconds and the default interval is 1s.
  • Use the milliseconds="true/yes/1" custom tag attribute to use milliseconds.
  • Use the interval="value" custom tag attribute to set the interval (unsigned integer).
  • Use the tag attribute (GTK+ property) visible="false" to hide the timer.
  • Disabling the timer pauses it, enabling the timer unpauses it.
The timer is created enabled by default, but if you want it disabled then use the <sensitive>false</sensitive> directive or the sensitive="false" tag attribute.

The timer itself doesn't affect CPU usage (I tested with 255x1s timers) but what the application developer executes on the "tick" signal will.

<timer> widget example:

Code: Select all

#!/bin/sh

# NOTE: This example requires at least gtkdialog-0.7.21 (please visit
# http://code.google.com/p/gtkdialog/). Additionally if you are using
# Puppy Linux then you may find that an historical version of gtkdialog
# already exists in /usr/sbin, and if that is the case then you should
# modify the shell variable below to point to the new gtkdialog binary.

GTKDIALOG=gtkdialog

function funcpixCreate() {
	for f in 0 1 2 3; do
		echo '<pixmap>
				<variable>pix'$1$f'</variable>
				<input file>pix'$f'.svg</input>
			</pixmap>'
	done
}

function funcbtnCreate() {
	echo '<button>
			<input file stock="'$1'"></input>
			<action>'$2':tmr0</action>
			<action>'$2':tmr1</action>
			<action>'$2':tmr2</action>
			<action>'$2':tmr3</action>
		</button>'
}

function functmrCreate() {
	echo '<variable>tmr'$1'</variable>
			<action>funcpixRandomise</action>
			<action>refresh:pix'$1'0</action>
			<action>refresh:pix'$1'1</action>
			<action>refresh:pix'$1'2</action>
			<action>refresh:pix'$1'3</action>
		</timer>'
}

function funcimageCreate() {
	local -a colours=("a00000" "00a000" "0000a0" "ffffff")
	echo '
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
	<rect x="0" y="0" height="64" width="64" fill="#'${colours[$1]}'"/>
</svg>' > image$1.svg
}; export -f funcimageCreate

function funcpixRandomise() {
	local rand=
	for f in 0 1 2 3; do
		rand=$(($RANDOM % 4))
		ln -sf image$rand.svg pix$f.svg
	done
}; export -f funcpixRandomise

if [ ! -f image0.svg ]; then funcimageCreate 0; fi
if [ ! -f image1.svg ]; then funcimageCreate 1; fi
if [ ! -f image2.svg ]; then funcimageCreate 2; fi
if [ ! -f image3.svg ]; then funcimageCreate 3; fi

funcpixRandomise

export MAIN_DIALOG='
<window title="tmrTimer" resizable="false">
	<vbox>
		<frame timer widget>
			<vbox border-width="20">
				<hbox>
					<timer>
						'"$(functmrCreate 0)"'
					'"$(funcpixCreate 0)"'
				</hbox>
				<hbox>
					<timer interval="2">
						'"$(functmrCreate 1)"'
					'"$(funcpixCreate 1)"'
				</hbox>
				<hbox>
					<timer milliseconds="true" visible="false">
						'"$(functmrCreate 2)"'
					'"$(funcpixCreate 2)"'
				</hbox>
				<hbox>
					<timer milliseconds="true" interval="500" visible="false">
						'"$(functmrCreate 3)"'
					'"$(funcpixCreate 3)"'
				</hbox>
			</vbox>
		</frame>
		<hbox>
			'"$(funcbtnCreate gtk-no disable)"'
			'"$(funcbtnCreate gtk-yes enable)"'
			<button ok></button>
		</hbox>
	</vbox>
	<action signal="hide">exit:Exit</action>
</window>
'

$GTKDIALOG --center --program=MAIN_DIALOG
Regards,
Thunor
Last edited by thunor on Fri 12 Aug 2011, 14:41, edited 2 times in total.

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

#172 Post by Geoffrey »

I tried to compile the latest but it seems to have a problem, I don't really know much about this so it could be me.

Here is what I get after running make.

Code: Select all

widget_timer.o: In function `widget_timer_timer_callback':
/root/gtkdialog/src/widget_timer.c:379: undefined reference to `gtk_widget_get_sensitive'
widget_timer.o: In function `widget_timer_envvar_construct':
/root/gtkdialog/src/widget_timer.c:137: undefined reference to `gtk_widget_get_sensitive'
collect2: ld returned 1 exit status
make[3]: *** [gtkdialog] Error 1
make[3]: Leaving directory `/root/gtkdialog/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/root/gtkdialog/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/gtkdialog'
make: *** [all] Error 2
The previous version worked fine for me, seems to be the timer widget is the problem.

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#173 Post by 01micko »

I tried to compile the latest but it seems to have a problem, I don't really know much about this so it could be me.
Working ok in Slacko-312.37

Don't you use quirky-NOP Geoffrey? gtk+ version is old in that.
Puppy Linux Blog - contact me for access

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

#174 Post by Geoffrey »

01micko wrote:
I tried to compile the latest but it seems to have a problem, I don't really know much about this so it could be me.
Working ok in Slacko-312.37

Don't you use quirky-NOP Geoffrey? gtk+ version is old in that.

Yeah, quirky 1.20 NOP, strange though it has worked ok up until now, I may have reached it's limitations, not to worry
I should look at using a newer version of puppy, It's just that I prefer xfce as a window manager.

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#175 Post by disciple »

thunor wrote:
zigbert wrote:...moving items inside a <tree> widget...using gtk-options.
The GTK+ property is "reorderable".

Regards,
Thunor
Ah, that's cool.

An interesting point is that neither method works after you sort the tree by clicking on a column header.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#176 Post by thunor »

Geoffrey wrote:

Code: Select all

...
/root/gtkdialog/src/widget_timer.c:379: undefined reference to `gtk_widget_get_sensitive'
...
Hi Geoffrey

Sorry about that. gtk_widget_get_sensitive requires GTK+ 2.18.0 and I missed it, but thanks for letting me know as there is an older alternative which I've included and committed :)

Interestingly its sister function gtk_widget_set_sensitive already exists within the project and has no version requirements.

Regards,
Thunor
Last edited by thunor on Fri 12 Aug 2011, 10:10, edited 1 time in total.

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#177 Post by disciple »

I don't have the very latest gtkdialog here, but I'm guessing this isn't fixed yet:
seaside wrote:
potong wrote:sunburnt:
Here's a program written in two ways to show the different options.


Secondly --event-driven=filename

Code: Select all

#!/usr/sbin/gtkdialog3 -e
display(){ echo "Display: ${!1}"; }
...............
Just wanted to add that using the "#!/usr/sbin/gtkdialog3" event form requires that gtkdialog3 is symlinked to gtkdialog, otherwise it errs. I ran into this earlier using the "event driven" form of gtkdialog - no matter from a file or on the command line.

Potong, thanks for supplying all this great information on Gtkdialog. It is immensely helpful.

Regards,
s
Can anyone confirm?
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#178 Post by disciple »

In other words, if the executable is named something other than "gtkdialog", then you need to create a link to it named "gtkdialog", to be able to use the event-driven option.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#179 Post by thunor »

disciple wrote:In other words, if the executable is named something other than "gtkdialog", then you need to create a link to it named "gtkdialog", to be able to use the event-driven option.
Well it's fixed now :) The "gtkdialog" binary name was hardcoded.

Regards,
Thunor

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#180 Post by thunor »

The badly named <visible>disabled </visible> directive has been deprecated in favour of <sensitive>false/no/0</sensitive> which is what it actually is. I'm going to remove <visible> from the wiki so that folk don't use it anymore.

Post Reply