Page 52 of 76

Posted: Thu 01 Oct 2015, 20:34
by PastorEdBTwo
Geoffrey -

Thank you for responding. However adding the ampersand (&) after the program name in the action does NOT make the original gtkdialog menu go away.

It just lets me run the command, with the menu still active in the background.

For example:

Code: Select all

<menuitem icon="accessories-calculator"><label>Calculator</label><action>galculator &</action></menuitem>
DOES run the program "galculator" - but right over the top of the still-in-existence-not-dismissed menu.

What I'm wanting to happen is whenever I select a program, the menu is dismissed right after I've clicked it AS the program is launching.[/code]

Posted: Thu 01 Oct 2015, 22:14
by Geoffrey
PastorEdBTwo wrote:It just lets me run the command, with the menu still active in the background.

For example:

Code: Select all

<menuitem icon="accessories-calculator"><label>Calculator</label><action>galculator &</action></menuitem>
DOES run the program "galculator" - but right over the top of the still-in-existence-not-dismissed menu.

What I'm wanting to happen is whenever I select a program, the menu is dismissed right after I've clicked it AS the program is launching.[/code]
This will fix it, you need to run exit also. :)

Code: Select all

<menuitem icon="accessories-calculator"><label>Calculator</label><action>galculator &</action><action>exit:Quit</action></menuitem>

Posted: Thu 01 Oct 2015, 22:33
by PastorEdBTwo
WHOO HOO!

The combination of the last two hints makes it work:

Both the ampersand (&) AND the <action>exit:Quit</action> command make it work the way I want.

Thanks, everyone! It works a treat. Here's the final result:

Image

comboboxentry widget

Posted: Mon 12 Oct 2015, 15:50
by Argolance

Posted: Wed 14 Oct 2015, 00:19
by don570
to PastorEdBTwo...


You could make the cancel button small (homogeneous) and place it in the middle or to
to extreme side of a column ---> Thunor's tip

I show how in gtkdialog manual

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

___________________________________________

Another tip - I found that <window> widget is needed when
using gtkdialog in Ubuntu

Scripts just wouldn't work without it.

_____________________________________

Posted: Sat 17 Oct 2015, 19:30
by don570
To make two buttons appear in the middle of a column --->

Here's a simple example...

width-request="300" is needed to make the column wide so space
will show.
#!/bin/sh
export MAIN='
<window resizable="true">

<hbox width-request="300" homogeneous="true"> <hbox>

<button cancel></button>
<button>
<label>"Set"</label>
<input file stock="gtk-ok"></input>

<action>EXIT:exit</action>
</button>
</hbox> </hbox>
</window>

'

gtkdialog -c -p MAIN

export variable to dialog

Posted: Wed 21 Oct 2015, 04:48
by mavrothal
In a script a have a function that exports a viariable, say test_func() that exports TEST_VAR. Then in then gtkdialog gui I have

Code: Select all

<action>test_func</action>
<action>echo $TEST_VAR</action>
and TEST_VAR is empty.
If I run test_func before I call gtkdialog then TEST_VAR is there.
I guess I need some way to tell to a running dialog to import this newly generated variable.
How could I do that?
Thanks.

Posted: Wed 21 Oct 2015, 16:02
by SFR
Hey Mavrothal

As far as I know everything enclosed by a single <action>...</action> tags is executed in a seaparate subshell, so any changes made to variables won't get back to a parent shell.
Well, taking your example, this would work:

Code: Select all

<action>test_func; echo $TEST_VAR</action>
since it's still in boundaries of the very same subshell, but not much beyond that; $TEST_VAR's value will be lost in next line...

The only way I know to freely share data between subshells is to use some kind of IPC, e.g. a temp file or named pipe.

Greetings!

Posted: Wed 21 Oct 2015, 18:04
by mavrothal
SFR wrote:The only way I know to freely share data between subshells is to use some kind of IPC, e.g. a temp file or named pipe.
Thanks. I'll try this then.

Posted: Thu 22 Oct 2015, 06:29
by tele1234567891
https://code.google.com/p/gtkdialog/w/list

web page is in read only,
exist newer version with newer code and updated tutorial?

Posted: Thu 22 Oct 2015, 22:52
by don570
If you're looking for source code....

http://ftp.nl.freebsd.org/pub/pub/ibibl ... 8.4.tar.xz

____________________________________

Posted: Wed 09 Dec 2015, 01:20
by don570
Tip:

If you're using a button to close the window and then initiate some processing
of the data.....

your button should assign the exit variable to a word,
if you don't ----> the exit variable will be the label text. If you use
gettext it could be a foreign word.

EXAMPLE:

Code: Select all

<button>
<input file stock="gtk-ok"></input>
<label>"'"$(gettext 'Apply')"'"</label>
<action>exit:CLICKED</action>
</button>

Without the line <action>exit:CLICKED</action>
the exit variable would be assigned the foreign word for 'Apply'

Posted: Mon 21 Dec 2015, 19:08
by don570
Tip :

In a situation where you have two text widgets that you want to be horizontal , I found a situation where 'echo -n' is important.

Here's an example. The second text widget is simply loading a number
from a text file, but I found that the number needs a line ending.

Code: Select all

echo -n  "5" >  /tmp/pcount 
provides that line ending

Code: Select all

 <hbox>
         <text>
            <variable>TEXTFLD</variable>
            <label>Times Button pressed: </label>
         </text>
         
         <text>
            <variable>TEXTWD</variable>
            <input>cat /tmp/pcount</input>
         </text>
      </hbox> 
Look at the difference between a line ending(the top image) and no line ending(the bottom image)

Image

Posted: Mon 21 Dec 2015, 19:58
by zigbert
This was a great tip. I used echo -n to fix 2 vertical alignment issues in pMusic.

Thank you

Posted: Mon 11 Jan 2016, 18:32
by step
The code below displays two side-by-side pictures with editable captions.
Image #1 in the attached screenshot shows the right side of the window.
I can't get it to look right. I want it to look like Image #2. Basically I want to eliminate the bleeding window color from inside the <frame> so that picture background and text background blend. I added some styles to ease the task, but still I can't get image #1 to look like image #2. Help me please.

You need to place a test image in /tmp/test.png, save this code as /tmp/test.xml, save the styles to /tmp/test.rc, write some caption text to /tmp/test.txt, and run with

Code: Select all

gtkdialog --space-expand=true --space-fill=true --styles /tmp/test.rc -s < /tmp/test.xml
Thanks in advance.

Code: Select all

<window name="filmstripWindow" resizable="false">
  <vbox>
    <hbox>
      <vbox>
        <frame>
          <eventbox name="filmstripPictureFrame">
            <pixmap yalign="0">
              <variable export="false">y0x0</variable>
              <width>180</width>
              <height>120</height>
              <input>/tmp/test.png</input>
            </pixmap>
	    <action signal="button-press-event">echo >&2 pressed y0x0</action>
          </eventbox>
          <edit name="filmstripCaption" cursor-visible="false" editable="false" accepts-tab="false" wrap-mode="2" hscrollbar-policy="2" vscrollbar-policy="2">
            <variable export="false">y0x0c</variable>
            <input file>/tmp/test.txt</input>
            <width>200</width>
            <height>60</height>
          </edit>
        </frame>
      </vbox>
      <vbox>
        <frame>
          <eventbox name="filmstripPictureFrame">
            <pixmap yalign="0">
              <variable export="false">y0x1</variable>
              <width>180</width>
              <height>120</height>
              <input file>/tmp/test.png</input>
            </pixmap>
	    <action signal="button-press-event">echo >&2 pressed y0x1</action>
          </eventbox>
          <edit name="filmstripCaption" cursor-visible="false" editable="false" accepts-tab="false" wrap-mode="2" hscrollbar-policy="2" vscrollbar-policy="2">
            <variable export="false">y0x1c</variable>
            <input file>/tmp/test.txt</input>
            <width>200</width>
            <height>60</height>
          </edit>
        </frame>
      </vbox>
    </hbox>
    <hbox space-fill="false" space-expand="false">
      <text space-fill="true" space-expand="true"><label>""</label></text>
      <button tooltip-text="Help" stock-icon-size="1">
        <input file stock="gtk-about"></input>
        <action>launch:GUI_ABOUT</action>
      </button>
      <button tooltip-text="Help" stock-icon-size="1">
        <input file stock="gtk-about"></input>
        <action>launch:GUI_ABOUT</action>
      </button>
      <button tooltip-text="Exit" stock-icon-size="1">
        <input file stock="gtk-quit"></input>
        <action>exit:EXIT</action>
      </button>
    </hbox>
  </vbox>
</window>

Code: Select all

style "styleWindow" {
	bg[NORMAL] = "#DCDAD5"
}
style "stylePictureFrame" {
	bg[NORMAL] = "#fff"
}
style "styleCaption" {
	bg[NORMAL] = "#fff"
}

widget "*filmstripWindow" style "styleWindow"
widget "*filmstripPictureFrame" style "stylePictureFrame"
widget "*filmstripCaption" style "styleCaption"

Posted: Mon 11 Jan 2016, 22:16
by zigbert
step
<vbox> and <hbox> has a default margin of 5 pixels. This can be overwritten by

<vbox margin="0">

If this didn't help you, give a note...

Posted: Tue 12 Jan 2016, 00:22
by don570
a guess...
Do your testing with resizable="true"

Code: Select all

<window name="filmstripWindow" resizable="true"> 
_______________________________

Posted: Tue 12 Jan 2016, 12:44
by step
Hi, thanks for helping me.
I added margin="0" to all vbox and hbox tags: no visible change.
I changed resizable to false (but I need it true in the final code): no visible change.
Still unresolved.

Posted: Tue 12 Jan 2016, 15:03
by MochiMoppel
For debugging I took the liberty to make the code simpler. Here is how far I got:
To eliminate the horizontal border between the eventbox and the edit widget you have set spacing="0" for the vbox (vboxes have a default spacing of 5px).
However this is not sufficient to remove the border. You also have to place the vbox inside the frame. Looks OK to me now.

Code: Select all

<window name="filmstripWindow" resizable="false"> 
<vbox> 
 <hbox> 
   <frame Frametitle> 
   <vbox spacing="0">
	   <eventbox name="filmstripPictureFrame"> 
			<pixmap yalign="0"> 
				<variable export="false">y0x1</variable> 
				<width>180</width> 
				<height>120</height> 
				<input file>/tmp/test.png</input> 
			</pixmap> 
			<action signal="button-press-event">echo >&2 pressed y0x1</action> 
	   </eventbox> 
	   <edit margin="0" name="filmstripCaption" cursor-visible="false" editable="false" accepts-tab="false" wrap-mode="2" hscrollbar-policy="2" vscrollbar-policy="2"> 
		 <variable export="false">y0x1c</variable> 
		 <input file>/tmp/test.txt</input> 
		 <width>200</width> 
		 <height>60</height> 
	   </edit>
   </vbox> 
	</frame> 
 </hbox> 
 <hbox space-fill="false" space-expand="false"> 
   <text space-fill="true" space-expand="true"><label>""</label></text> 
   <button tooltip-text="Help" stock-icon-size="1"> 
	 <input file stock="gtk-about"></input> 
	 <action>launch:GUI_ABOUT</action> 
   </button> 
   <button tooltip-text="Help" stock-icon-size="1"> 
	 <input file stock="gtk-about"></input> 
	 <action>launch:GUI_ABOUT</action> 
   </button> 
   <button tooltip-text="Exit" stock-icon-size="1"> 
	 <input file stock="gtk-quit"></input> 
	 <action>exit:EXIT</action> 
   </button> 
 </hbox> 
</vbox> 
</window>

Posted: Tue 12 Jan 2016, 16:22
by step
Thanks MochiMoppel for helping me, this is good!
Left: no margin and frame inside vbox (adding spacing="0" makes no difference)
Center: spacing="0" and frame outside, as you pointed out
Right: spacing="0" and no frame.

edit 2015-1-13 margin->spacing