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 Sat 26 Jul 2014, 01:13
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
force update of radiobutton in gtkdialog
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [5 Posts]  
Author Message
sc0ttman


Joined: 16 Sep 2009
Posts: 2372
Location: UK

PostPosted: Mon 12 Aug 2013, 14:45    Post subject:  force update of radiobutton in gtkdialog
Subject description: how to make the 'other' option get selected
 

i'd like to force update of a radiobutton in gtkdialog from within the gui itself.. i can't seem to make it work..

EDIT... SOLVED: see my next post.

Basically, when I click a button somewhere, I want the selected values of a couple of radiobuttons elsewhere (another tab in a <notebook>) to be changed to match the new values of their vars ($PKGSCOPE1 and $PKGSCOPE2)....

i have something like (just an example, but basically right):

Code:

the_func(){
if [ "$PKGSCOPE1" = true ];then
  PKGSCOPE1=false
else
  PKGSCOPE1=true
fi
if [ "$PKGSCOPE2" = true ];then
  PKGSCOPE2=false
else
  PKGSCOPE2=true
fi
export PKGSCOPE1
export PKGSCOPE2
}

GUI='<window><frame>
<button>
<action>the_func</action>
<action>refresh:PKGSEARCH1</action>
<action>refresh:PKGSEARCH2</action>
</button>

<hbox>
<radiobutton>
<variable>PKGSEARCH1</variable>
<default>"'$PKGSEARCH1'"</default>
</radiobutton>
<radiobutton>
<variable>PKGSEARCH2</variable>
<default>"'$PKGSEARCH2'"</default>
</radiobutton>
</hbox>

</frame>
</window>'


(i'm using bash not ash to run the script..)

EDIT: Likewise, I want the same button to update the pre-selected value of a <combobox>, which is in yet another tab of the <notebook>..

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search

Last edited by sc0ttman on Mon 12 Aug 2013, 16:40; edited 1 time in total
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5009
Location: Arizona, U.S.A.

PostPosted: Mon 12 Aug 2013, 15:55    Post subject:  

Hi sc0ttman; If you notice, Puppy`s pmount dies then restarts to refresh the GUI.

But I think there`s a way to do it in code since GtkDialog is active again.

The dev. page:
http://www.murga-linux.com/puppy/viewtopic.php?t=69188

And zigbert`s tips:
http://www.murga-linux.com/puppy/viewtopic.php?t=38608
Back to top
View user's profile Send private message 
sc0ttman


Joined: 16 Sep 2009
Posts: 2372
Location: UK

PostPosted: Mon 12 Aug 2013, 16:38    Post subject:  

Sorted:

added

Code:
<radiobutton auto-refresh="true">
<variable>PKGSCOPEONE</variable>
<input file>/tmp/PKGSCOPEONE</input>
...
</radiobutton>

and can toggle with these commands:

Code:
echo -n false > /tmp/PKGSCOPEONE; echo -n true > /tmp/PKGSCOPEALL;


Code:
echo -n true > /tmp/PKGSCOPEONE; echo -n false > /tmp/PKGSCOPEALL;

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3212
Location: Ontario

PostPosted: Mon 12 Aug 2013, 19:50    Post subject:  

When I was writting puppy-rsync I found it impossible to transfer the
values of the radiobutton variable to a function.


I was able to solve the problem by putting

Code:

set -a


near beginning of program. This transfers widget gtkdialog variables
in a useful way. The user clicks on a button in window and the
true/false values of radio buttons are transfered to a function that
does a launch.

That is how I transfer the folder number ( one to five)
___________________________________________________
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3212
Location: Ontario

PostPosted: Tue 13 Aug 2013, 20:31    Post subject:  

I have been testing Scottman's idea in my program
puppy-rsync. I included a button 'Test' in the window to test
if I could manipulate the radio buttons false/true state.

I found that I could but I had to use set -a as well.

The radiobutton widget was modified like this

Code:
 <radiobutton auto-refresh="true">
<input file>/root/FILE</input>
 ...
 


..and the button widget was ..

Code:

 <button>
       <input file stock="gtk-ok"></input>
      <label>'$(gettext 'Test')'</label>
      <action>echo -n true > /root/FILE;</action>
</button>



I found I could do some useful things Wink


_________________________________
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [5 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.0601s ][ Queries: 11 (0.0037s) ][ GZIP on ]