Page 2 of 2

Re: Xdialog: here's how to create a color message

Posted: Tue Jul 25, 2023 12:50 pm
by Sofiya

Code: Select all

#!/bin/sh
Xdialog --default-item 2 --checklist "Select:" 0 0 5 \ 1 "First element" disabled \ 2 "Second element" disabled \ 3 "Third element" disabled

Code: Select all

#!/bin/sh

Xdialog --msgbox "This is a very important message and should be read carefully!" 0 0
Xdialog --default-item 2 --checklist "Select:" 0 0 5 \ 1 "First element" off \ 2 "Second element" on \ 3 "Third element" on

Re: Xdialog: here's how to create a color message

Posted: Tue Jul 25, 2023 2:53 pm
by jamesbond
rcrsn51 wrote: Tue Jul 25, 2023 11:48 am

@jamesbond I cannot get the --default-item option to work with a menubox widget in the new gtk3 Xdialog.

Thank you for the report. I fixed that and brought --default-item back in 2.3.5.

All my other conversions are going well.

Thank you for the confirmation.

In places where I have used "height width" numbers other than "0 0" , I just replace them with pixel values like "600x400".

In updated 2.3.4 (and in 2.3.5) I have made the GTK3 version "auto-shrink" just like the GTK2 version. But it prudent not to depend on this feature because the default size is always that ... default, and it may be different for different versions.

Thanks.

You're much welcome.

@Sofiya, as per the original documentation for --default-item, it is only meant for --menubox, not for anything else (not for --checklist as well). --checklist has a different way to set the default, as you have already found out.


Re: Xdialog: here's how to create a color message

Posted: Tue Jul 25, 2023 4:58 pm
by rcrsn51
dimkr wrote: Mon Jul 24, 2023 6:49 am

... a small bunch of scripts

That's a bit presumptuous.


Re: Xdialog: here's how to create a color message

Posted: Tue Jul 25, 2023 5:40 pm
by dimkr
rcrsn51 wrote: Tue Jul 25, 2023 4:58 pm
dimkr wrote: Mon Jul 24, 2023 6:49 am

... a small bunch of scripts

That's a bit presumptuous.

From my perspective - yes, Puppy is a small project. I deal with big and buggy codebases with many dependencies and >=100k lines of code, on a daily basis :)

(And if you worry about compatibility with a range of GTK+ versions, maybe you should translate those scripts, or just the UI part, to some compiled language like C or Rust, then use GTK+ directly. Your code won't compile if it's incompatible with GTK+ version x, and you'll get warnings about deprecated GTK+ features that will go away in the next major version, making ongoing maintenance easier in some ways.)


Re: Xdialog: here's how to create a color message

Posted: Tue Jul 25, 2023 5:51 pm
by rcrsn51
jamesbond wrote: Tue Jul 25, 2023 2:53 pm

Thank you for the report. I fixed that and brought --default-item back in 2.3.5.

That's working again.

In updated 2.3.4 (and in 2.3.5) I have made the GTK3 version "auto-shrink" just like the GTK2 version. But it prudent not to depend on this feature because the default size is always that ... default, and it may be different for different versions.

It now looks like "0 0" is equivalent to "100x50". The window auto-sizes to fit the content.


Re: Xdialog: here's how to create a color message

Posted: Wed Jul 26, 2023 11:46 am
by rcrsn51

@jamesbond Would it be possible to add a feature to the combobox widget? Could the --default-item option be used to put a default value in the combobox? That way, it doesn't start off blank, which has a confusing appearance.

In the gtk2 version, the box starts off by showing the first item in the drop-down list.

Bill


Re: Xdialog: here's how to create a color message

Posted: Thu Jul 27, 2023 2:42 pm
by jamesbond

@rcrsn51, it should already work that way too in GTK 3 version, as the code for GTK2 and GTK3 for combobox is identical.


Re: Xdialog: here's how to create a color message

Posted: Thu Jul 27, 2023 2:49 pm
by Sofiya

in GTK 3 (comboboxtext)?


Re: Xdialog: here's how to create a color message

Posted: Thu Jul 27, 2023 11:19 pm
by rcrsn51

My mistake. The --default-item option is already working with a combobox in 2.3.5, as does --editable.