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 21 Aug 2014, 18:09
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
GtkDialog - tips
Post new topic   Reply to topic View previous topic :: View next topic
Page 49 of 64 [947 Posts]   Goto page: Previous 1, 2, 3, ..., 47, 48, 49, 50, 51, ..., 62, 63, 64 Next
Author Message
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: 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
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: 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
View user's profile Send private message Visit poster's website 
oldyeller


Joined: 15 Nov 2011
Posts: 779
Location: Mishawaka IN

PostPosted: 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
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3254
Location: Ontario

PostPosted: 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
View user's profile Send private message 
oldyeller


Joined: 15 Nov 2011
Posts: 779
Location: Mishawaka IN

PostPosted: 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
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3254
Location: Ontario

PostPosted: 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.

YES-NO.gz
Description  Remove .gz extension to obtain script
gz

 Download 
Filename  YES-NO.gz 
Filesize  2.28 KB 
Downloaded  155 Time(s) 

Last edited by don570 on Sat 16 Feb 2013, 15:36; edited 2 times in total
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3254
Location: Ontario

PostPosted: 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


Last edited by don570 on Sat 16 Feb 2013, 15:41; edited 3 times in total
Back to top
View user's profile Send private message 
recobayu


Joined: 15 Sep 2010
Posts: 112
Location: indonesia

PostPosted: 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
limukstart.gz
Description  remove .gz, chmod +x
gz

 Download 
Filename  limukstart.gz 
Filesize  3.74 KB 
Downloaded  153 Time(s) 

_________________
myblog: http://muktyas.blogspot.com
Back to top
View user's profile Send private message 
smokey01


Joined: 30 Dec 2006
Posts: 1801
Location: South Australia

PostPosted: 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
View user's profile Send private message Visit poster's website 
recobayu


Joined: 15 Sep 2010
Posts: 112
Location: indonesia

PostPosted: 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?
limukstart2.gz
Description  I reupload. hope this can appearing scrollbar
gz

 Download 
Filename  limukstart2.gz 
Filesize  3.76 KB 
Downloaded  158 Time(s) 
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5675
Location: Valåmoen, Norway

PostPosted: 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
View user's profile Send private message Visit poster's website 
SFR


Joined: 26 Oct 2011
Posts: 1053

PostPosted: 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!
v.png
 Description   
 Filesize   6.48 KB
 Viewed   482 Time(s)

v.png


_________________
[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
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5675
Location: Valåmoen, Norway

PostPosted: 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
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4335

PostPosted: 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.

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
oldyeller


Joined: 15 Nov 2011
Posts: 779
Location: Mishawaka IN

PostPosted: 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
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 49 of 64 [947 Posts]   Goto page: Previous 1, 2, 3, ..., 47, 48, 49, 50, 51, ..., 62, 63, 64 Next
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.1247s ][ Queries: 13 (0.0225s) ][ GZIP on ]