Gtkdialog examples from DEVX

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

Gtkdialog examples from DEVX

#1 Post by 8-bit »

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?

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

#2 Post by seaside »

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) :D

s

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

#3 Post by 8-bit »

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.

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

#4 Post by technosaurus »

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 [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
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#5 Post by 8-bit »

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

Code: Select all

#! /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.

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

#6 Post by technosaurus »

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: Select all

<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 [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
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#7 Post by 8-bit »

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.

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#8 Post by aragon »

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: maybe memoving would be better...
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: Select all

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

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

#9 Post by 8-bit »

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.

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#10 Post by aragon »

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

Post Reply