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 Thu 18 Dec 2014, 06:44
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 Posts_count  
Author Message
sc0ttman


Joined: 16 Sep 2009
Posts: 2386
Location: UK

PostPosted: Mon 12 Aug 2013, 14:45    Post_subject:  force update of radiobutton in gtkdialog
Sub_title: 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

Edited_time_total
Back to top
View user's profile Send_private_message 
sunburnt


Joined: 08 Jun 2005
Posts: 5043
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: 2386
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: 3435
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: 3435
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:   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.0595s ][ Queries: 12 (0.0040s) ][ GZIP on ]