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 Wed 26 Nov 2014, 00:13
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 Posts_count  
Author Message
oldyeller


Joined: 15 Nov 2011
Posts: 818
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
;;

Edited_time_total
Back to top
View user's profile Send_private_message 
sunburnt


Joined: 08 Jun 2005
Posts: 5042
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: 3972
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_website 
sunburnt


Joined: 08 Jun 2005
Posts: 5042
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: 818
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:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0549s ][ Queries: 12 (0.0039s) ][ GZIP on ]