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 Tue 02 Sep 2014, 20:31
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How do I add 3 buttons on my script SOLVED
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [5 Posts]  
Author Message
oldyeller


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

PostPosted: Thu 08 Aug 2013, 21:59    Post subject:  How do I add 3 buttons on my script SOLVED  

Hello Everyone,

I am trying to get three buttons on my remove delete script so people will have a choice to 1 remove 2 delete 3 cancel. I am using Xdialog for this.

This here is just for two buttons with this setup you can only do one or the other.

Just am not sure just how to do this, any help would be great thanks

Code:

#!/bin/sh

export RESOURCES="/usr/local/Manna/resources"
export REMOVE_DIR="/usr/local/Manna/removed"

if  [ -d /usr/local/Manna/resources/Apocrypha/001tobittxt ]; then
 Xdialog --title "Remove" --cancel-label "Remove from computor" --ok-label "Remove from Menu"  --yesno "\n Remove Tobit \n" 0 0
 if [[ $? == 0 ]]; then
  mv $RESOURCES/Apocrypha/001tobittxt $REMOVE_DIR/
 fi
if [[ $? == 0 ]]; then
 rm -r $RESOURCES/Apocrypha/001tobittxt
 fi
 fi
exit 0
;;

Last edited by oldyeller on Fri 09 Aug 2013, 21:15; edited 1 time in total
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5016
Location: Arizona, U.S.A.

PostPosted: Thu 08 Aug 2013, 23:24    Post subject:  

Xdialog is pre-made dialogs, changing them ain`t easy.

xmessage can have any number of only buttons
Type in a VT for help: xmessage --help

Run rxvt or xterm and type in this line:
Code:
xmessage "xMessage Test" -buttons "# 1:1,# 2:2,# 3:3" ; echo $?
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3964
Location: Kiel,Germany

PostPosted: Fri 09 Aug 2013, 05:39    Post subject:  

xmessage is one of my favorites - it's kinda ugly gui though .

Don't know if in recent Pups xmessage still works since it is linked to pup?dialog .

If there are many buttons, xmessage might hide the buttons in the right offscreen .

One simple thing is to hit the close button in the title bar - Returnvalue might be -1, 254 or 255 .

Also to provide a second gui "Are You REALLY SURE to delete $VAR" YES/No might be not a bad idea .

urxvt -e dialog --extra-button might be a crude and ugly workaround .

The old shutdown dialogs used them in shutdownconfig/rc.shutdown . Now it is yaf I think . Yaf-splash might provide a third button , too .

I would look into the newish shutdownconfig script for examples .
Back to top
View user's profile Send private message Visit poster's website 
sunburnt


Joined: 08 Jun 2005
Posts: 5016
Location: Arizona, U.S.A.

PostPosted: Fri 09 Aug 2013, 14:14    Post subject:  

I agree, xmessage => gxmessage is ugly.

Puppy use to have xmessage and it looked much better.!
Back to top
View user's profile Send private message 
oldyeller


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

PostPosted: Fri 09 Aug 2013, 21:15    Post subject:  

Hi All,

@sunburnt I did look at xmessage not what I would use for this though-I am somewhat in favor of Xdailog more.

@Karl Godt I did look at rc.shutdown in lupu 528 and I did notice that it uses an --extra-button and --extra-label. Could not get this to work for me, lack of knowledge on my part.

This is what I decided to do. I added a safty net sort of speaking by adding another gui asking if they really want to Delete from computer. I was thinking on this when I saw your post about adding this also.

Thanks to the both of you for your ideas and showing me about xmessage maybe will use for something else. But I still prefer Xdailog just because I know more about it.

Thanks again.

Code:

#!/bin/sh

export RESOURCES="/usr/local/Manna/resources"
export REMOVE_DIR="/usr/local/Manna/removed"

if  [ -d /usr/local/Manna/resources/Apocrypha/001tobittxt ]; then
 Xdialog --title "Remove" --cancel-label "Remove from computor" --ok-label "Remove from Menu" --yesno "\n Remove Tobit from Menu or Delete from Computer this is permanent!! \n" 0 0
 if [[ $? == 0 ]]; then
  mv $RESOURCES/Apocrypha/001tobittxt $REMOVE_DIR/
 fi
 Xdialog --title "Delete" --cancel-label "Cancel" --ok-label "Remove from Computer" --yesno "\n Are you sure you want to Delete from Computer? This is permanent!! \n" 0 0
 if [[ $? == 0 ]]; then
  rm -r $RESOURCES/Apocrypha/001tobittxt
 fi
fi
exit 0
;;
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [5 Posts]  
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.0600s ][ Queries: 11 (0.0122s) ][ GZIP on ]