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 Mon 22 Dec 2014, 08:15
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 Posts_count  
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: 1119

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: 3437
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: 5814
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_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:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0695s ][ Queries: 11 (0.0049s) ][ GZIP on ]