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 Fri 19 Sep 2014, 17:56
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Gtkdialog update script window, not open a new one?
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [6 Posts]  
Author Message
thanius

Joined: 04 Feb 2014
Posts: 8

PostPosted: Wed 12 Feb 2014, 14:43    Post subject:  Gtkdialog update script window, not open a new one?  

Is it possible for gtkdialog to update the window using new content instead of having to close and open a new window?
I need a script where I press a button (options) to open up a new dialog -WITHIN- the existing one, exchanging the current dialog.

OPTION_DIALOG='
<window>
<vbox>
<button><label>Back to Main</label><action>CHANGE_SCRIPT: MAIN</action></button>
</vbox>
</window>
'

MAIN_DIALOG='
<window>
<vbox>
<button><label>Options</label><action>CHANGE_SCRIPT: OPTION_DIALOG</action></button>
</vbox>
</window>
'

Possible or not?
Cheers.
Back to top
View user's profile Send private message 
SFR


Joined: 26 Oct 2011
Posts: 1068

PostPosted: Wed 12 Feb 2014, 15:34    Post subject:  

From what I know it's not possible to replace widgets in already opened window, but you can always prepare various GUIs on subsequent tabs of <notebook> widget and switch between them, e.g.:

Code:
#!/bin/bash

export PAGE=/tmp/notebook_page_${$}
echo 0 > $PAGE
trap 'rm $PAGE' EXIT

export MAIN='
<window>
  <notebook show-tabs="false">
   
    <vbox>
      <text><label>This is first page</label></text>
      <checkbox><label>some checkbox</label></checkbox>
      <entry><default>some entry</default></entry>
      <edit><default>edit field</default></edit>   
      <button>
        <label>Show Options</label>
        <action>echo 1 >${PAGE}</action>
        <action>refresh:NOTEBOOK</action>
      </button>
    </vbox>
   
    <vbox>
      <text><label>This is second page</label></text>
      <radiobutton></radiobutton>
      <tree><item>some</item><item>tree</item></tree>
      <button>
        <label>Back to main</label>
        <action>echo 0 > ${PAGE}</action>
        <action>refresh:NOTEBOOK</action>
      </button>
    </vbox>
 
    <variable>NOTEBOOK</variable>
    <input file>'${PAGE}'</input>
  </notebook>
</window>'

gtkdialog -p MAIN

Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3287
Location: Ontario

PostPosted: Wed 12 Feb 2014, 19:51    Post subject:  

I did an example with a togglebutton widget

Clicking on the toggle button changed the window and changed the
label of the button that did the toggling.


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

_____________________________________________________
Back to top
View user's profile Send private message 
thanius

Joined: 04 Feb 2014
Posts: 8

PostPosted: Thu 13 Feb 2014, 04:20    Post subject:  

Exactly was I was looking for! Thanks!
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5726
Location: Valåmoen, Norway

PostPosted: Thu 13 Feb 2014, 08:20    Post subject:  

Using a <notebook> is ok, but more flexible is the solution to hide/show any widget - also <h/vbox> that hides everything inside the box.

example for togglebutton:
<action>if true show:MY_VBOX</aciton>

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
thanius

Joined: 04 Feb 2014
Posts: 8

PostPosted: Sat 15 Feb 2014, 05:12    Post subject:  

The vbox hiding works, but I cannot make the other "dialog" appear with same method, so I guess I'm sticking with the notebook-widget.

I need some help with some problems I'm having trying to style a checkbox. I want to have a flat checkbox without focus colors, which I've managed through widget_class Checkbutton, but I want to have different colors on certain checkbutton labels.

For example, I want one checkbutton with gtklabel normal grey and highlight black. On the other dialog I want a checkbutton with normal black and no hightlight.

As a workaround I've made a checkbox widget with a blank label, then put a text widget on front of that, but I want the text to act as a toggle so hopefully I can get this sorted out.
Cheers.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [6 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.0607s ][ Queries: 12 (0.0042s) ][ GZIP on ]