You are not logged in.

#1 2012-12-23 22:07:58

ssgross
Member
Registered: 2012-06-20
Posts: 7

Xdialog --default-no not working in bash

Hi,
I am using Xdialog version

$ pacman -Qs xdialog
local/xdialog 2.3.1-6
    A drop-in replacement for the 'dialog' or 'cdialog' programs

The example below should move the default (initial) button to "No". It does not.

#!/bin/bash

Xdialog --title " My first dialog" --default-no \
        --yesno "Hello , this is my first dialog program" 10 30

case $? in
  0)
    echo "Yes chosen.";;
  1)
    echo "No chosen.";;
  255)
    echo "ESC pressed.";;
esac

The behavior is the same when using

 --defaultno 

On the other hand,
--defaultno works fine with "dialog" instead of "Xdialog"

$ man xdialog

--default-no

              This option may be used with all widgets with a "Cancel" or "No"
              button.  Note  that it is ignored when the --wizard option is in
              force.

Am I missing something? --default-no is a transient option, and comes after the common options, according to the man page. This is how I have it in the above code.

On a separate note, any ideas about how to put no on the left and cancel on the right?

EDIT:
Another strange behavior, pressing escape doesn't show the 255)  message, but shows the no message - another difference to dialog

Last edited by ssgross (2012-12-23 22:34:35)

Offline

Board footer

Powered by FluxBB