Gtkdialog togglebutton question [Solved]

For discussions about programming, and for programming questions and advice


Moderator: Forum moderators

Post Reply
User avatar
fredx181
Posts: 2610
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 284 times
Been thanked: 1015 times
Contact:

Gtkdialog togglebutton question [Solved]

Post by fredx181 »

EDIT: found out already, using:

Code: Select all

[ -z $(which blabla) ] && export SMODE=false || export SMODE=true
and at the BLAOPTS variable:

Code: Select all

<sensitive>'$SMODE'</sensitive>
instead of action condition= at the EXTRA variable
------------------------------------------------------------------------
Hi all, trying to disable a variable "BLAOPTS" with togglebutton uncollapsed as well as collapsed (at start of script).
With setting EXTRA=false (as below, uncollapsed) it works OK, but I'd like it to work also when you set EXTRA=true (collapsed)

Code: Select all

export EXTRA=false

[ -z $(which flac) ] && export FLAC=1
# obviously "blabla" is not in PATH
[ -z $(which blabla) ] && export BLA=1

export MAIN='
<window title="Toggle button example" resizable="false"> 
     <vbox>

     <vbox visible="'$EXTRA'">

       <hbox space-expand="true" space-fill="true">
<text><label>Flac options:</label></text>
     <combobox>
       <variable>FLACOPTS</variable>
       <item>--compression-level-5</item>
       <item>--compression-level-1</item>
     </combobox>
      </hbox>

      <hbox space-expand="true" space-fill="true">	
	<text><label> BLA options:</label></text>	
     <combobox>
       <variable>BLAOPTS</variable>
       <item>-c2000</item>
       <item>-c1000</item>
     </combobox>
      </hbox>

        <variable>varTOGGLE</variable>

      </vbox>

      <vbox>
      <hbox>
     <togglebutton>
        <label>"Options"</label>
        <default>'$EXTRA'</default>
        <variable>EXTRA</variable>
        <action>if true show:varTOGGLE</action>
        <action>if false hide:varTOGGLE</action>
        <action condition="command_is_true( echo $FLAC )">disable:FLACOPTS</action>
        <action condition="command_is_true( echo $BLA )">disable:BLAOPTS</action>
      </togglebutton>

	<button>
	<label>'Quit'</label>
	<input file stock="gtk-quit"></input>
	<action type="exit">exit</action>
	</button>
      </hbox>
      </vbox>
</vbox>
</window>'

gtkdialog --program=MAIN --center
Thanks,

Fred
Post Reply

Return to “Programming”