Gtkdialog: help?
July 24, 2011 —
BarryK
I have been trawling through the forum, trying to find a solution for this. I am using thunor's revision-83 gtkdialog package.
I have started work on /usr/bin/petspec, and I want the main window to be able to open child windows. Yes, this works, but the only way to close the child window is to click the close-box on the window.
The original 0.7.20 official examples give this example of a child window:
export DIALOG='
<vbox>
<text>
<label>This is an other dialog window.</label>
</text>
<button>
<label>Close</label>
<action type="closewindow">DIALOG</action>
</button>
</vbox>
'
The main window launches the child by this:
<button>
<label>launch</label>
<action type="launch">DIALOG</action>
</button>
I recall Patriot discussing this sometime ago, and it did apparently work. I have tried various things, can't get a button in the child window to close itself.
There was some discussion back in 2009:
http://www.murga-linux.com/puppy/viewtopic.php?t=50253
Is there a gtkdialog guru reading this who can help out?
Comments
Child WindowUsername: 8-nit
Barry, I still had this and it works. Hope that helps. [code] #! /bin/bash export CHILD=' <window title="CHILD"> <vbox> <text> <variable>CHILD</variable> <label>This is the child window.</label> </text> <button> <label>close window</label> <action type="closewindow">CHILD</action> </button> </vbox> </window>' export MAIN_DIALOG=' <window title="Main"> <vbox> <frame Button actions> <hbox> <button> <label>launch child</label> <action type="launch">CHILD</action> </button> <button> <label>close window</label> <action type="closewindow">CHILD</action> </button> </hbox> </frame> <hbox> <button ok></button> <button cancel></button> </hbox> </vbox> </window> ' gtkdialog3 --program=MAIN_DIALOG [/code]
Mistake
Username: 8-bit
"I blew it typing my name, so you do not need to add 8-nit. Sorry. Still I hope that code helps.
timeout
Username: scsijon
"not for some time so my versioning is seriously out of date, but I seem to remember that you could open a window for a stated time or await an action (button push/mouse click) before it selfcloses, would that do? I wonder if he included that function (or not), maybe that is why it's not working.
It doesn't work
Username: BarryK
"8-bit, The code you have shown doesn't work. Your code has two buttons for closing the child window -- the main in the main window might work, but not the one in the child window. I want a button in the child window to close the child window.
no problem here
Username: maxerro
"gtkdialog3 v0.7.20 in Lucid has no problem with it. It's just that child's: <text> <variable>[b]THIS NAME[/b]</variable> </text> [b]must match[/b] <button> <label>Close</label> <action type="closewindow">[b]THIS NAME[/b]</action> </button>
Child Window revisited
Username: 8-bit
"I just again pulled up the example I posted and ran it. Both the child window "close window" button and the one in the main program close the child window just fine. Are you sure you have the latest gtkdialog3 compiled? The reason I ask is that thunor's modifications are complied as gtkdialog. I copy the resulting gtkdialog from compiling to gtkdialog3 and place it in /usr/sbin with a link to it called "gtkdialog" in the same directory.
Child close "works"
Username: BarryK
"Ah, I see: [code]export DLG_REPONAME=' <vbox> <text> <label>This is another dialog window.</label> <variable>VAR_RP</variable> </text> <button ok> <label>Close</label> <action type="closewindow">VAR_RP</action> </button> </vbox> ' [/code] The name of the child window has nothing to do with it! This is a really weird way that it works. I think that we should give this to thunor as a bug report, so that "closewindow" works in a more rational way.
Child window
Username: BarryK
"Oh, more is becoming clear. The child window is not really a proper window, only a "message box". It can only have the one text label in it, so it seems.
Nope, can have others
Username: 8-bit
"I just got back from combining two gtkdialog examples. I took the 01.02-button_action_types that I had added a variable command to and , leaving the text part of DIALOG, I pasted in 09.10-tree_stock_icons. The result was that I had a lot more than just a child text box. So a little quick playing proved you can expand on it as long as you have the short text with variable as part of the child application.
overproduction
Username: maxerro
"Bare in mind that if the dialog and the variable have different names, it is possible to reproduce unlimited number of children, but only the youngest will respond to the Close button. For "one child policy" the dialog name and the variable name must match in order to control this.
Child window
Username: BarryK
"Thanks for the feedback. I have written my enhanced 'petspec' utility.
Tags: puppy