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 Wed 23 Apr 2014, 13:55
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Gtkdialog examples from DEVX
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [10 Posts]  
Author Message
8-bit


Joined: 03 Apr 2007
Posts: 3286
Location: Oregon

PostPosted: Mon 15 Feb 2010, 17:49    Post subject:  Gtkdialog examples from DEVX
Subject description: 07.02-list_actions
 

The example /usr/doc/gtkdialog/examples/07.02-list_actions script maxes out my processor when I run it and I have to kill it.
I tried making another button and putting the echo line there.
The program would then be ok until I clicked that button and again max out the processor.
So, any ideas as to why?
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 878

PostPosted: Thu 18 Feb 2010, 12:37    Post subject:  

8-bit,

I don't have an answer to this question and I just wanted you to know that it happens when I try it also.

(I haven't used "list" and perhaps it's just as well) Very Happy

s
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3286
Location: Oregon

PostPosted: Thu 18 Feb 2010, 14:35    Post subject:  

Thank you for the reply.
I also tried modifying the script by putting the echo line in an action call using the ok button to call it.
Then I tried adding xmessage without the echo.
There was no change as to processor maxing out and xmessage failed to display any output.
So I will keep playing round with it.
For now, I know not to use that form of list in any programs.
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4134

PostPosted: Thu 18 Feb 2010, 15:20    Post subject:  

could you paste the example - I am not at a Puppy box to check it, but I can examine the script - it probably just needs a sleep 1 inserted somewhere in a loop. This one may have already been discussed in the gtkdialog tips thread.
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3286
Location: Oregon

PostPosted: Thu 18 Feb 2010, 18:09    Post subject:  

You ask for the original example file and here it is 07.02-list_actions

Code:

#! /bin/bash

export MAIN_DIALOG='
  <vbox>
    <list>
      <variable>LIST</variable>
      <item>First item</item>
      <item>Second item</item>
      <item>Third item</item>
      <action>echo Chosen item is $LIST</action>
    </list>
    <hbox>
     <button ok></button>
     <button cancel></button>
    </hbox>
  </vbox>
'

gtkdialog3 --program=MAIN_DIALOG


I already tried moving the action line to be acted on by the OK button.
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4134

PostPosted: Thu 18 Feb 2010, 18:55    Post subject:  

hmm - I would use a "combobox" for that instead of a list - I have a template for combobox in the how to section

http://www.murga-linux.com/puppy/viewtopic.php?t=45474


Code:
<combobox>
    <variable>COMBO1</variable>
    <item>item 1</item>
    <item>item 2</item>
</combobox>


then you will either need to eval MAIN_DIALOG after exit for the value of $COMBO1 or set up and action within the dialog window such as
Xdialog --infobox $COMBO1 0 0

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3286
Location: Oregon

PostPosted: Fri 19 Feb 2010, 00:56    Post subject:  

I realize their are work arounds for the example program.
But.....
Why are there example programs in the /usr/share/doc/gtkdialog3/examples directory that just do not work.
Isn't an example supposed to work?

Also, can one find out where the example program is at fault and correct it?
Is it a matter of a debug option?
Everything seems fine till the <action>echo Chosen item is $LIST</action>
line is executed.
As to what is happening, that is to find out.
And the echo never takes place even when run from a terminal.
Back to top
View user's profile Send private message 
aragon

Joined: 15 Oct 2007
Posts: 1696
Location: Germany

PostPosted: Wed 24 Feb 2010, 06:01    Post subject:  

8-bit wrote:
I realize their are work arounds for the example program.
But.....
Why are there example programs in the /usr/share/doc/gtkdialog3/examples directory that just do not work.
Isn't an example supposed to work?

yes that also drived me crazy for many times Twisted Evil maybe memoving would be better...
Quote:
Also, can one find out where the example program is at fault and correct it?

not really, but with the following, it does work and echos the choosen value...

Code:
#! /bin/bash

export MAIN_DIALOG='
  <vbox>
    <list>
      <variable>LIST</variable>
      <item>First item</item>
      <item>Second item</item>
      <item>Third item</item>
    </list>
  <hbox>
   <button ok></button>
   <button cancel></button>
  </hbox>
  </vbox>
'

I=$IFS; IFS=""
for STATEMENTS in  $(gtkdialog3 --program MAIN_DIALOG); do
  eval $STATEMENTS
done
IFS=$I

if [ "$EXIT" = "OK" ]; then
  echo "Chosen item is $LIST."
else
  echo "You pressed the Cancel button."
fi


aragon

_________________
PUPPY SEARCH: http://wellminded.com/puppy/pupsearch.html
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3286
Location: Oregon

PostPosted: Wed 24 Feb 2010, 06:43    Post subject:  

aragon,

It appears to work because it exits to show $LIST.
But I have an option for you.
When creating a GUI, why have it use the echo command?
That entails running it from a terminal to see the output of the echo command.
Instead, just replace "echo" with "xmessage".
Then the output will be displayed in a GUI type message box.
Back to top
View user's profile Send private message 
aragon

Joined: 15 Oct 2007
Posts: 1696
Location: Germany

PostPosted: Wed 24 Feb 2010, 07:37    Post subject:  

8-bit wrote:
aragon,

It appears to work because it exits to show $LIST.
But I have an option for you.
When creating a GUI, why have it use the echo command?
That entails running it from a terminal to see the output of the echo command.
Instead, just replace "echo" with "xmessage".
Then the output will be displayed in a GUI type message box.

sure, but i wanted to leave it as it has been in the example...

but usually this is to give parameter to an external comand.

aragon

_________________
PUPPY SEARCH: http://wellminded.com/puppy/pupsearch.html
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [10 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.0555s ][ Queries: 12 (0.0039s) ][ GZIP on ]