Xdialog: here's how to create a color message

interpretive language scripts


Moderator: Forum moderators

User avatar
Sofiya
Posts: 2294
Joined: Tue Dec 07, 2021 9:49 pm
Has thanked: 1483 times
Been thanked: 1546 times

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

Post 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
Attachments
Снимок экрана(1).png
Снимок экрана(1).png (12.22 KiB) Viewed 1360 times
Снимок экрана.png
Снимок экрана.png (12.74 KiB) Viewed 1360 times

KL
PUPPY LINUX Simple fast free

jamesbond
Posts: 718
Joined: Tue Aug 11, 2020 3:02 pm
Location: The Pale Blue Dot
Has thanked: 124 times
Been thanked: 402 times

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

Post 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.

User avatar
rcrsn51
Posts: 1390
Joined: Sun Aug 23, 2020 4:26 pm
Been thanked: 357 times

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

Post by rcrsn51 »

dimkr wrote: Mon Jul 24, 2023 6:49 am

... a small bunch of scripts

That's a bit presumptuous.

dimkr
Posts: 2436
Joined: Wed Dec 30, 2020 6:14 pm
Has thanked: 53 times
Been thanked: 1205 times

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

Post 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.)

User avatar
rcrsn51
Posts: 1390
Joined: Sun Aug 23, 2020 4:26 pm
Been thanked: 357 times

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

Post 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.

Last edited by rcrsn51 on Wed Jul 26, 2023 11:48 am, edited 1 time in total.
User avatar
rcrsn51
Posts: 1390
Joined: Sun Aug 23, 2020 4:26 pm
Been thanked: 357 times

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

Post 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

jamesbond
Posts: 718
Joined: Tue Aug 11, 2020 3:02 pm
Location: The Pale Blue Dot
Has thanked: 124 times
Been thanked: 402 times

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

Post 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.

User avatar
Sofiya
Posts: 2294
Joined: Tue Dec 07, 2021 9:49 pm
Has thanked: 1483 times
Been thanked: 1546 times

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

Post by Sofiya »

in GTK 3 (comboboxtext)?

KL
PUPPY LINUX Simple fast free

User avatar
rcrsn51
Posts: 1390
Joined: Sun Aug 23, 2020 4:26 pm
Been thanked: 357 times

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

Post by rcrsn51 »

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

Post Reply

Return to “Scripts”