How to add an extra-button to Xdialog GUI? (Solved by using pupdialog instead)

For discussions about programming, and for programming questions and advice


Moderator: Forum moderators

Post Reply
User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

How to add an extra-button to Xdialog GUI? (Solved by using pupdialog instead)

Post by taersh »

Hi.

I'm trying to get a Xdialog GUI to have 3 buttons. Xdialog has options --extra-button and --extra-label, but I can't get the 3rd button to show up within the gui. Using --yesno gives only 2 buttons, using --msgbox gives only 1 button, using --infobox closes the GUI immediately.

Is option --extra-button deprecated without mentioning it in the help output?
Last edited by taersh on Mon Oct 05, 2020 4:27 pm, edited 1 time in total.

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
fredx181
Posts: 2680
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 295 times
Been thanked: 1056 times
Contact:

Re: Xdialog option --extra-button

Post by fredx181 »

taersh wrote:Xdialog has options --extra-button and --extra-label
dialog has that, not Xdialog AFAIK

Fred
User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: Xdialog option --extra-button

Post by taersh »

Terminal output on Xdialog
Xdialog v2.3.1 by Thierry Godefroy <xdialog@free.fr> (v1.0 was
written by Alfred at Cyberone Internet <alfred@cyberone.com.au>).
Xdialog home page available at: http://xdialog.dyns.net/

Usage: Xdialog [<common options>] [<transient options>] <box option> ...

Common options:
--wmclass <name>
--rc-file <gtkrc filename>
--backtitle <backtitle>
--title <title>
--allow-close | --no-close
--screen-center | --under-mouse | --auto-placement
--center | --right | --left | --fill
--no-wrap | --wrap
--cr-wrap | --no-cr-wrap
--stderr | --stdout
--separator <character> | --separate-output
--buttons-style default|icon|text

Transient options:
--fixed-font
--password (may be repeated 2 or 3 times before --2inputsbox or --3inputsbox)
--password=1|2 (for --2inputsbox or --3inputsbox)
--editable
--time-stamp | --date-stamp
--reverse
--keep-colors
--interval <timeout>
--timeout <timeout> (in seconds)
--no-tags
--item-help (if used, the {...} parameters are needed in menus/lists widgets)
--default-item <tag>
--icon <xpm filename>
--no-ok
--no-cancel
--no-buttons
--default-no
--wizard
--help <help>
--print <printer> (1)
--check <label> [<status>]
--ok-label <label>
--cancel-label <label>
--extra-button
--extra-label <label>
--beep
--beep-after
--begin <Yorg> <Xorg>
--ignore-eof
--smooth

Box options:
--yesno <text> <height> <width>
--msgbox <text> <height> <width>
--infobox <text> <height> <width> [<timeout>]
--gauge <text> <height> <width> [<percent>]
--progress <text> <height> <width> [<maxdots> [[-]<msglen>]]
--inputbox <text> <height> <width> [<init>]
--2inputsbox <text> <height> <width> <label1> <init1> <label2> <init2>
--3inputsbox <text> <height> <width> <label1> <init1> <label2> <init2> <label3> <init3>
--combobox <text> <height> <width> <item1> ... <itemN>
--rangebox <text> <height> <width> <min value> <max value> [<default value>]
--2rangesbox <text> <height> <width> <label1> <min1> <max1> <def1> <label2> <min2> <max2> <def2>
--3rangesbox <text> <height> <width> <label1> <min1> <max1> <def1> ... <label3> <min3> <max3> <def3>
--spinbox <text> <height> <width> <min value> <max value> <default value> <label>
--2spinsbox <text> <height> <width> <min1> <max1> <def1> <label1> <min2> <max2> <def2> <label2>
--3spinsbox <text> <height> <width> <min1> <max1> <def1> <label1> ... <min3> <max3> <def3> <label3>
--textbox <file> <height> <width>
--editbox <file> <height> <width>
--tailbox <file> <height> <width>
--logbox <file> <height> <width>
--menubox <text> <height> <width> <menu height> <tag1> <item1> {<help1>}...
--checklist <text> <height> <width> <list height> <tag1> <item1> <status1> {<help1>}...
--radiolist <text> <height> <width> <list height> <tag1> <item1> <status1> {<help1>}...
--buildlist <text> <height> <width> <list height> <tag1> <item1> <status1> {<help1>}...
--treeview <text> <height> <width> <list height> <tag1> <item1> <status1> <item_depth1> {<help1>}...
--fselect <file> <height> <width>
--dselect <directory> <height> <width>
--colorsel <text> <height> <width> [<red> <green> <blue>]
--fontsel <font name> <height> <width>
--calendar <text> <height> <width> [<day> <month> <year>]
--timebox <text> <height> <width> [<hours> <minutes> <seconds>]

Special options:
--version (prints version number to stderr and exits).
--print-version (same as above in a cdialog-compatible way).
--print-maxsize (prints maximum menu size in characters and exits).

Note that <height> and <width> are in characters and may be replaced by a single
XSIZExYSIZE[+/-XORG+/-YORG] parameter (like the one passed in the -geometry option
of X) which will represent the size of the Xdialog window in pixels. Specifying
a size of 0 0 (or 0x0) will auto-size Xdialog, while a size of -1 -1 (or -1x-1)
will maximize it.

(1) This Xdialog binary compiled with: lpr -P<printer>
as the print command. If <printer> is "" (an empty string), the -P
option is not used.

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
MochiMoppel
Posts: 1145
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 18 times
Been thanked: 376 times

Re: How to add an extra-button to Xdialog GUI?

Post by MochiMoppel »

taersh wrote: Sat Oct 03, 2020 9:35 pmIs option --extra-button deprecated without mentioning it in the help output?
My help output for v2.3.1 does not mention --extra-button, otherwise looks the same as yours. Not mentioned in the documentation either.

Fred is right. It's an option in dialog, not Xdialog. Don't know why you get this output.
This works for dialog when run from console:
dialog --extra-button --yesno "hello" 0 0
Try to add 'X' and see if it works. Does nothing for me.
User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: How to add an extra-button to Xdialog GUI?

Post by taersh »

I'm using pupdialog instead.
Works good, does what I need.

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
wiak
Posts: 3712
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 58 times
Been thanked: 1036 times
Contact:

Re: How to add an extra-button to Xdialog GUI?

Post by wiak »

extra-button patch from amigo (old though):

http://murga-linux.com/puppy/viewtopic. ... c72#499840

Above link is referred to in pupdialog by BarryK here:

https://bkhome.org/archive/blog2/201109 ... ith-x.html

Using gtkdialog solutions is surely over-the-top bloated for simple few buttons scenarios though? Of course, relying on patched Xdialog is not useful for anyone using non-patched Xdialog, so maybe pupdialog is the way to go (especially if it does fall back to using straight dialog when no X?) and, on second thoughts, I guess 'bloat' is relative - nowadays, that level of bloat (introduced by gtkdialog) is probably insignificant but the question would be: 'does gtkdialog itself have a future?'.

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
MochiMoppel
Posts: 1145
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 18 times
Been thanked: 376 times

Re: How to add an extra-button to Xdialog GUI?

Post by MochiMoppel »

taersh wrote: Sat Oct 03, 2020 9:35 pmI'm trying to get a Xdialog GUI to have 3 buttons. Xdialog has options --extra-button and --extra-label, but I can't get the 3rd button to show up within the gui. Using --yesno gives only 2 buttons, using --msgbox gives only 1 button, using --infobox closes the GUI immediately.
The patched version as linked by wiak and included in fossapup64 does work with certain Xdialog boxes, e.g. --inputbox
Last edited by MochiMoppel on Mon Oct 05, 2020 8:48 am, edited 1 time in total.
User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: How to add an extra-button to Xdialog GUI?

Post by taersh »

I don't want to hassle around with patched versions others perhaps don't have installed by default.
Pupdialog does what I need and it's in all Puppies by default.

Also I don't want to argue if gtkdialog has a future, as this to answer is probably beyond my future. :lol:

Gtkdialog being bloated? :roll:

Really, what kind of computer are you running?

64Kb RAM? ;)

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
MochiMoppel
Posts: 1145
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 18 times
Been thanked: 376 times

Re: How to add an extra-button to Xdialog GUI?

Post by MochiMoppel »

Pupdialog does what I need and it's in all Puppies by default.
Maybe you should tell us what you need it for. Pupdialog has very limited options and even crashes when --extra-button is used with --inputbox. Hardly a substitute for Xdialog.
User avatar
01micko
Posts: 134
Joined: Mon Jul 13, 2020 4:08 am
Location: Qld
Has thanked: 5 times
Been thanked: 63 times
Contact:

Re: How to add an extra-button to Xdialog GUI?

Post by 01micko »

I went through the Xdialog sources and --extra-button was never implemented for --yesno box. The extra button is a patch added by a third party and collected by old murga member amigo. I find it strange that it works in calendar, time, various other text boxes and other box options but not 'yesno' box option.

Well I made a patch for @jamesbond to consider for his Xdialog chiselapp repo

The latest Xdialog source tarball is at the FatDog repo so if you're feeling adventurous you grab that, apply the following attached diff and compile it. Works with all the tests in the source code.
foobarbaz.png
foobarbaz.png (10.06 KiB) Viewed 524 times

Code: Select all

Xdialog --extra-button --extra-label "foo" --ok-label "bar" --cancel-label "baz"  --yesno 'Who do you want to be? Foo, Bar or Baz?' 0 0
Attachments
Xdialog-exbtn-yesno.diff.gz
(517 Bytes) Downloaded 36 times
User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: How to add an extra-button to Xdialog GUI?

Post by taersh »

MochiMoppel wrote: Mon Oct 05, 2020 3:40 am
Pupdialog does what I need and it's in all Puppies by default.
Maybe you should tell us what you need it for. Pupdialog has very limited options and even crashes when --extra-button is used with --inputbox. Hardly a substitute for Xdialog.
I just need the three buttons with --yesno to make a selection like in the patched Xdialog example at the above post.
For more complex stuff like --inputbox etc.pp. I'm using gtkdialog directly.

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

jamesbond
Posts: 605
Joined: Tue Aug 11, 2020 3:02 pm
Location: The Pale Blue Dot
Has thanked: 99 times
Been thanked: 324 times

Re: How to add an extra-button to Xdialog GUI? (Solved by using pupdialog instead)

Post by jamesbond »

Thanks @01micko, I will take a look.
jamesbond
Posts: 605
Joined: Tue Aug 11, 2020 3:02 pm
Location: The Pale Blue Dot
Has thanked: 99 times
Been thanked: 324 times

Re: How to add an extra-button to Xdialog GUI? (Solved by using pupdialog instead)

Post by jamesbond »

I have finally got the time to review the patch.
I did it slightly differently.
Here's the patch that gets committed.

The updated source is dated 2020.10 and is available from here or you can clone it from chiselapp.com as 01micko pointed out earlier.

Thanks again 01micko for the pointer.

Code: Select all

Index: src/interface.c
==================================================================
--- src/interface.c
+++ src/interface.c
@@ -774,10 +774,12 @@
 			if (Xdialog.cancel_button)
 				set_button(CANCEL , hbuttonbox, 1, FALSE);
 			set_button(NEXT, hbuttonbox, 0, TRUE);
 		} else {
 			set_button(YES, hbuttonbox, 0, !Xdialog.default_no);
+			if (Xdialog.extra_button)
+				set_button(EXTRA, hbuttonbox, 5, FALSE);
 			button = set_button(NO , hbuttonbox, 1, Xdialog.default_no);
 			if (Xdialog.default_no)
 				gtk_widget_grab_focus(button);
 		}
 	} else 

Attachments
xdialog-extra-button.patch.gz
(287 Bytes) Downloaded 36 times
Post Reply

Return to “Programming”