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 28 Aug 2014, 03:14
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
Gtkdialog Development
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 12 of 55 [821 Posts]   Goto page: Previous 1, 2, 3, ..., 10, 11, 12, 13, 14, ..., 53, 54, 55 Next
Author Message
disciple

Joined: 20 May 2006
Posts: 6428
Location: Auckland, New Zealand

PostPosted: Thu 11 Aug 2011, 07:31    Post subject:  

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/viewtopic.php?p=549651#549651
_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6428
Location: Auckland, New Zealand

PostPosted: Thu 11 Aug 2011, 07:37    Post subject:  

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.

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Thu 11 Aug 2011, 08:49    Post subject:  

zigbert wrote:
...moving items inside a <tree> widget...using gtk-options.

The GTK+ property is "reorderable".

Regards,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: Thu 11 Aug 2011, 11:33    Post subject:  

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
Back to top
View user's profile Send private message 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Thu 11 Aug 2011, 12:34    Post subject:  

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
Back to top
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Thu 11 Aug 2011, 18:41    Post subject:  

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:
#!/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, 10:41; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website 
Geoffrey


Joined: 30 May 2010
Posts: 1356
Location: Queensland Australia ɹǝpu∩uʍop

PostPosted: Thu 11 Aug 2011, 19:30    Post subject:  

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:
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.
Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 7794
Location: qld

PostPosted: Thu 11 Aug 2011, 19:49    Post subject:  

Quote:
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.

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
Geoffrey


Joined: 30 May 2010
Posts: 1356
Location: Queensland Australia ɹǝpu∩uʍop

PostPosted: Thu 11 Aug 2011, 20:32    Post subject:  

01micko wrote:
Quote:
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.
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6428
Location: Auckland, New Zealand

PostPosted: Fri 12 Aug 2011, 05:31    Post subject:  

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.

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Fri 12 Aug 2011, 05:41    Post subject:  

Geoffrey wrote:
Code:
...
/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 Smile

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, 06:10; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
disciple

Joined: 20 May 2006
Posts: 6428
Location: Auckland, New Zealand

PostPosted: Fri 12 Aug 2011, 06:07    Post subject:  

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:
#!/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?

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6428
Location: Auckland, New Zealand

PostPosted: Fri 12 Aug 2011, 06:08    Post subject:  

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.
_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Fri 12 Aug 2011, 07:12    Post subject:  

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 Smile The "gtkdialog" binary name was hardcoded.

Regards,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Fri 12 Aug 2011, 07:19    Post subject:  

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.
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 12 of 55 [821 Posts]   Goto page: Previous 1, 2, 3, ..., 10, 11, 12, 13, 14, ..., 53, 54, 55 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
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.1165s ][ Queries: 13 (0.0138s) ][ GZIP on ]