Author |
Message |
8-bit

Joined: 03 Apr 2007 Posts: 3425 Location: Oregon
|
Posted: 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
|
|
 |
seaside
Joined: 11 Apr 2007 Posts: 917
|
Posted: 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)
s
|
Back to top
|
|
 |
8-bit

Joined: 03 Apr 2007 Posts: 3425 Location: Oregon
|
Posted: 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
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 4787 Location: Kingwood, TX
|
Posted: 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.
_________________ Check out my github repositories. I may eventually get around to updating my blogspot.
|
Back to top
|
|
 |
8-bit

Joined: 03 Apr 2007 Posts: 3425 Location: Oregon
|
Posted: 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
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 4787 Location: Kingwood, TX
|
Posted: 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
_________________ Check out my github repositories. I may eventually get around to updating my blogspot.
|
Back to top
|
|
 |
8-bit

Joined: 03 Apr 2007 Posts: 3425 Location: Oregon
|
Posted: 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
|
|
 |
aragon
Joined: 15 Oct 2007 Posts: 1698 Location: Germany
|
Posted: 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 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
|
|
 |
8-bit

Joined: 03 Apr 2007 Posts: 3425 Location: Oregon
|
Posted: 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
|
|
 |
aragon
Joined: 15 Oct 2007 Posts: 1698 Location: Germany
|
Posted: 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
|
|
 |
|