| Author |
Message |
thunor

Joined: 14 Oct 2010 Posts: 344 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Mon 07 Jan 2013, 13:52 Post_subject:
|
|
| RSH wrote: | Hi.
I wanted to test the above posted script but it gives me an gtkdialog error in gtkdialog3, gtidialog4 and gtkdialog5.
Which version is used for this script?
RSH |
Hi RSH
Change all <variable export="false"> to <variable> and it'll work. I'll edit the script and remove them, they're not necessary.
Regards,
Thunor
|
|
Back to top
|
|
 |
thunor

Joined: 14 Oct 2010 Posts: 344 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Mon 07 Jan 2013, 17:56 Post_subject:
|
|
Here's another top tip:
A text widget that has space-expand and space-fill set to true can be used as a spacer to push neighbouring widgets in certain directions.
Here the spacer text is "[]" so you can see it -- drag the window out and watch the button.
| Code: | #!/bin/sh
GTKDIALOG=gtkdialog
Spacer="[]"
MAIN_DIALOG='
<window title="Spacer Test" window-position="1">
<vbox>
<hbox>
<button space-expand="false" space-fill="false">
<label>This button will stay put</label>
<input file stock="gtk-about"></input>
</button>
<text space-expand="true" space-fill="true">
<label>"'$Spacer'"</label>
</text>
</hbox>
</vbox>
</window>
'
export MAIN_DIALOG
case $1 in
-d | --dump) echo "$MAIN_DIALOG" ;;
*) $GTKDIALOG --program=MAIN_DIALOG ;;
esac |
Regards,
Thunor
|
|
Back to top
|
|
 |
oldyeller

Joined: 15 Nov 2011 Posts: 499 Location: Mishawaka IN
|
Posted: Fri 11 Jan 2013, 17:48 Post_subject:
|
|
Hello Everyone,
I have a question, Has anyone done hyper-links in gtkdialog? If so how do you go about doing it.
What I would like to do is link from one program to another. Hit a word in one program to show the answer in another program.
Any help would be great thanks.
Cheers
|
|
Back to top
|
|
 |
don570

Joined: 10 Mar 2010 Posts: 2527 Location: Ontario
|
Posted: Sat 12 Jan 2013, 15:48 Post_subject:
|
|
| Quote: | | Hit a word in one program to show the answer in another program |
If you look at the code in puppy clock
you will see a button called 'World clock'
What it does is launch a second program.
You should check out how I wrote it.
When the button is first pressed, I check the version of
gtkdialog to make sure it is recent. Then I launch the second program.
_____________________________________________
|
|
Back to top
|
|
 |
oldyeller

Joined: 15 Nov 2011 Posts: 499 Location: Mishawaka IN
|
Posted: Sat 12 Jan 2013, 17:19 Post_subject:
|
|
Hi don570,
Will take a look and see if that is what I am looking for.
Cheers
EDIT: Hi don570 took a look not what I was looking for thanks, but I did remember that what I need is just a button to go to one to another program.
Just need to look at my code.
Cheers
|
|
Back to top
|
|
 |
don570

Joined: 10 Mar 2010 Posts: 2527 Location: Ontario
|
Posted: Thu 31 Jan 2013, 21:01 Post_subject:
|
|
Yes-No box with color
The Yes-No box in Xdialog is rather limited and the buttons
don't actually say 'Yes-No'
So I wrote a script to be a replacement to the Xdialog Yes-No box.
Here's a picture of the result.
| Description |
Remove .gz extension to obtain script
|

Download |
| Filename |
YES-NO.gz |
| Filesize |
2.28 KB |
| Downloaded |
45 Time(s) |
Edited_times_total
|
|
Back to top
|
|
 |
don570

Joined: 10 Mar 2010 Posts: 2527 Location: Ontario
|
Posted: Thu 31 Jan 2013, 21:09 Post_subject:
|
|
continuing......
The script has been made as general as possible.
The script first creats a file in /root.
Then the Yes-No box appears and asks if you want to overwrite the file
with different text. 'Yes' results in overwriting of the file and the
window closes. You can check to see if the file has been overwritten.
When the user clicks 'No' an alternate action is possible.
It is of course possible to have the 'No' button have one action
EDIT: I changed the script from using an if statement to a case statement.
This clearly shows that three posibilities are possible
1) YES
2) NO
3) Click on corner close box will cause cancellation
| Code: | #!/bin/bash
# demonstrate YES-NO box by don570
for P in gtkdialog4 gtkdialog3 gtkdialog; do
GTKDIALOG=$(which $P) && break
done
# create a message for demonstration
echo "first message" > /root/demonstrate-script.txt
TEXT="TEXT" # demonstrate a substitution in text
# put the warning-function near beginning of script
# orange color is #DA7A05
# purple color is #A900FF
warning-function(){
export MYWINDOW="
<window title=\"Warning\">
<frame>
<vbox>
<frame>
<pixmap>
<width>48</width>
<input file>/usr/share/pixmaps/hash.xpm</input>
</pixmap>
<vbox>
<text width-request=\"100\"><label>Color Frame</label></text>
<text use-markup=\"true\"><label>\"<b><u><span size='"'large'"'>???</span><span size='"'large'"' color='"#DA7A05"'>Overwrite</span> ??</u></b>\"</label></text>
<text use-markup=\"true\"><label>\"<b><span size='"'large'"' color='"blue"'>Danger </span><span size='"'large'"' color='"'red'"'>Destroy</span> $TEXT</b>\"</label></text>
<text use-markup=\"true\"><label>\"<b><span size='"'large'"' color='"'red'"'>Overwrite</span> $TEXT</b> text\"</label></text>
<text use-markup=\"true\"><label>\"<u><span size='"'large'"' color='"'#A900FF'"'>??????</span></u>\"</label></text>
</vbox>
</frame>
</vbox>
<vbox border-width=\"20\">
<text>
<label>Do you want to overwrite the file??</label>
</text>
</vbox>
<hseparator></hseparator>
<hbox homogeneous=\"true\">
<hbox>
<button>
<input file stock=\"gtk-yes\"></input>
<label>Yes</label>
<action>echo YES > /tmp/YES-NO.tmp</action>
<action>exit:EXIT</action>
</button>
</hbox>
<hbox>
<button>
<input file stock=\"gtk-no\"></input>
<label>No</label>
<action>echo NO > /tmp/YES-NO.tmp</action>
<action>exit:EXIT</action>
</button>
</hbox>
</hbox>
</frame>
</window>"
$GTKDIALOG --program MYWINDOW --center
}
warning-function # run the YES-NO box to ask user for permission
case "`cat /tmp/YES-NO.tmp`" in
YES) echo "second message" > /root/demonstrate-script.txt
echo "File has been overwritten" ;;
NO) echo "Do an alternate action" ;;
*) echo "Cancel" ;;
esac
rm -f /tmp/YES-NO.tmp # delete temp file
exit 0
# End of demonstration
|
Edited_times_total
|
|
Back to top
|
|
 |
recobayu

Joined: 15 Sep 2010 Posts: 87 Location: indonesia
|
Posted: Sun 10 Feb 2013, 14:34 Post_subject:
|
|
Hi everyone,
I play a little thing about gtkdialog.
finally, I make a 'Limukstart'. with gtktheme wdz8.1 from here:
http://murga-linux.com/puppy/viewtopic.php?p=671393#671393
my startmenu tobe like this:
but i still have a problem. I can't use mouse scroll to scroll horizontally with gtkdialog unless my pointer over the hscrollbar. Is possible to scroll horizontal with mouse? How?
Thanks
| Description |
remove .gz, chmod +x
|

Download |
| Filename |
limukstart.gz |
| Filesize |
3.74 KB |
| Downloaded |
44 Time(s) |
_________________ myblog: http://muktyas.blogspot.com
|
|
Back to top
|
|
 |
smokey01

Joined: 30 Dec 2006 Posts: 1642 Location: South Australia
|
Posted: Sun 10 Feb 2013, 15:33 Post_subject:
|
|
I needed to change the following line:
*) gtkdialog4 --program=MAIN_DIALOG ;;
Notice I added the 4 after gtkdialog.
Also the file needs to be renamed by removing the .gz and made executable.
I didn't get a horizontal scroll bar as my screen is quite wide.
_________________ Puppy Software <-> Distros <-> Puppy Linux Tips
|
|
Back to top
|
|
 |
recobayu

Joined: 15 Sep 2010 Posts: 87 Location: indonesia
|
Posted: Mon 11 Feb 2013, 00:33 Post_subject:
|
|
you are right, smokey01. thanks for your respond. I linked gtkdialog4 to gtkdialog. i reupload limukstart. i still can't scroll horizontally by mouse unless my pointer over the scroller. how?
| Description |
I reupload. hope this can appearing scrollbar
|

Download |
| Filename |
limukstart2.gz |
| Filesize |
3.76 KB |
| Downloaded |
37 Time(s) |
|
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 5291 Location: Valåmoen, Norway
|
Posted: Wed 13 Feb 2013, 07:51 Post_subject:
|
|
The vscale widget supports action signals as described inn the references | Code: | | <action signal="type">activity</action> |
Do anyone know what signal to use to run action WHILE moving slider?
Thanks
Sigmund
_________________ Stardust resources
|
|
Back to top
|
|
 |
SFR

Joined: 26 Oct 2011 Posts: 573
|
Posted: Wed 13 Feb 2013, 09:11 Post_subject:
|
|
@Recobayu
I think there's a reason why it works this way - if you would had both horizontal AND vertical scrollbars at the same time, they would be scrolled simultaneously.
But horizontal scrolling works fine when I use touchpad ('Horizontal Edge Scroll' enabled).
@Zigbert
Is this what you mean? (see screenshot)
If so, leaving the default "value-changed" signal makes the given action executed properly while moving slider:
| Code: | | echo '<window width-request="100" height-request="100"><vscale><variable>VAR</variable><action>echo $VAR</action></vscale></window>' | gtkdialog -s |
HTH
Greetings!
| Description |
|
| Filesize |
6.48 KB |
| Viewed |
308 Time(s) |

|
_________________ [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
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 5291 Location: Valåmoen, Norway
|
Posted: Wed 13 Feb 2013, 10:20 Post_subject:
|
|
SFR
I didn't have the 'value-changed' signal, but I had 'update-policy' defined.
- Now gone, and all works perfectly.
Thanks a lot!
Sigmund
_________________ Stardust resources
|
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 3845
|
Posted: Mon 18 Feb 2013, 13:51 Post_subject:
|
|
There are too many hacked ways of getting the screen width,height and depth that make assumptions on a specific version of xrandr, xwininfo and their output format and the string manipulation tends to be pretty slow so I wrote a small and fast little helper in C here:
http://murga-linux.com/puppy/viewtopic.php?p=685996#685996
let me know if there are any other PITA parameters that are often needed and I can add them.
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
|
|
Back to top
|
|
 |
oldyeller

Joined: 15 Nov 2011 Posts: 499 Location: Mishawaka IN
|
Posted: Tue 19 Feb 2013, 17:45 Post_subject:
|
|
Hello Everyone,
I have a question about menus, Can one put a menu in as a input file?
I will have a very big menu very soon and would like to know if this is possible
Thanks for any help
Cheers
|
|
Back to top
|
|
 |
|