Gtkdialog: help?

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?


Posted on 24 Jul 2011, 18:25


Comments:

Posted on 25 Jul 2011, 11:28 by 8-nit
Child Window
Barry, I still had this and it works. Hope that helps.

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



Posted on 25 Jul 2011, 11:31 by 8-bit
Mistake
I blew it typing my name, so you do not need to add 8-nit. Sorry.
Still I hope that code helps.



Posted on 25 Jul 2011, 11:32 by scsijon
timeout
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.


Posted on 25 Jul 2011, 12:15 by BarryK
It doesn't work
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.



Posted on 25 Jul 2011, 13:33 by maxerro
no problem here
gtkdialog3 v0.7.20 in Lucid has no problem with it.

It's just that child's:

<text>
<variable>THIS NAME</variable>
</text>

must match

<button>
<label>Close</label>
<action type="closewindow">THIS NAME</action>
</button>



Posted on 25 Jul 2011, 14:44 by 8-bit
Child Window revisited
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.





Posted on 25 Jul 2011, 16:14 by BarryK
Child close "works"
Ah, I see:

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>
'


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.



Posted on 25 Jul 2011, 16:37 by BarryK
Child window
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.



Posted on 25 Jul 2011, 17:09 by 8-bit
Nope, can have others
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.


Posted on 25 Jul 2011, 18:11 by maxerro
overproduction
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.



Posted on 25 Jul 2011, 18:14 by BarryK
Child window
Thanks for the feedback. I have written my enhanced 'petspec' utility.