I use these menus a lot for selecting items. So I'm sharing an Xdialog script (all Puppys should have XDialog, I think). Right-click the script and select "Open As Text" to edit. Use the attached example script to work from (remove the fake file extension). You can start an item by selecting its button and then clicking "OK" or just by double-clicking the item OR you can select a few items to open simultaneously. In the attached script I have all the Windows Programs I want to run with WINE listed and to be run quickly from the menu. You can manipulate the size of the box, use spaces to arrange the Title and contents of the box, change the icon, etc.
Make a menu list with Xdialog (Checklist box)
Moderator: Forum moderators
Make a menu list with Xdialog (Checklist box)
- Attachments
-
- WineProgs.gz
- (2.43 KiB) Downloaded 80 times
-
- capture32531.png (27.91 KiB) Viewed 2626 times
Re: Make a menu list with Xdialog (Checklist box)
Very nice. I was thinking of doing something similar for my appimages and wine apps instead of adding menus to jwm. This will come in handy.
Re: Make a menu list with Xdialog (Checklist box)
No, you get different boxes with different functions and different setups. The example used here is a checklist box. A menubox and radiolist box will also work in this instance but the checklist box has more options.
Re: Make a menu list with Xdialog (Checklist box)
The whole thing is called a widget. You decide which box you need inside the widget. The boxes have different functions, looks differently and are set up differently.
Re: Make a menu list with Xdialog (Checklist box)
I like/prefer the jwm choice myself. onroot=N ... menus created and add a button to the tray or assign it to a keycode. I have WIN+spacebar show the main menu, ALT+spacebar shows my bookmarks/urls.
I don't have a MENU button in my tray, I use the clock instead, where in jwm
Code: Select all
<Clock format="%H:%M %a %d %b">
<Button mask="1">root:1</Button>
<Button mask="2">showdesktop</Button>
<Button mask="3">root:3</Button>
</Clock>
Left mouse click (button 1) shows the main menu, middle button (2) acts as show/hide desktop and right mouse click (button 3) shows my bookmarks menu (root:3), where previously that root:3 was defined looking something like (snippet of the list of URL's) ...
Code: Select all
<RootMenu label="BookMarks" labeled="false" height="26" onroot="3">
<Program icon="yt" label="ytplayer">ytplayer</Program>
<Program icon="mini-dog" label="PuppyLinux">/opt/google/chrome/chrome --no-sandbox --start-maximized --js-flags='--jitless' -d https://forum.puppylinux.com</Program>
</RootMenu>
and where for the key based launching of those menus, in the keys section including
Code: Select all
<Key mask="4" key="space">root:1</Key> <!-- WIN-space main jwm menu -->
<Key mask="A" key="space">root:3</Key> <!-- ALT-space URL bookmarks menu -->
Keymask 4 being the WIN key.
Re: Make a menu list with Xdialog (Checklist box)
I've updated the example script. It will now allow you to run either 1 selected item OR more than one selected items simultaneously. See first post.
Re: Make a menu list with Xdialog (Checklist box)
Thank you for sharing this script. I digged Xdialog documentation and discovered that list may be represented as tree with --treeview instead of --checklist, sort of more organized, but can not figure out how to make it with my poor knowledge.
checklist and treeview examples looks similar, but <item_depth1> is what confusing me:
--checklist <text> <height> <width> <list height> <tag1> <item1> <status1>
--treeview <text> <height> <width> <list height> <tag1> <item1> <status1> <item_depth1>
I want my tree to look like this:
Code: Select all
text
| |-Spreadsheet32
| |-Wordpad
|
|
mp3
| |-Mp3Trackmaker
| |-mp3DirectCut
| |-Mp3tag
|
|
etc
As far as I understand, main branch entries (text, mp3, etc) should be "1" depth; sub-branches (Spreadsheet32, Wordpad) - "2" depth, but it doesn't work.
I just need a tip what need to be changed in this part of code:
Code: Select all
answer=`Xdialog --left --wrap --no-tags --icon /usr/share/pixmaps/wine48.png --stdout --title "Scripts" --treeview "Select your program of choice from the list." 0 0 11 "1" "text" "off" "1" "2" "Spreadsheet32" "off" "2" "3" "Wordpad" "off" "2" "4" "mp3" "off" "1"
- fredx181
- Posts: 3084
- Joined: Tue Dec 03, 2019 1:49 pm
- Location: holland
- Has thanked: 375 times
- Been thanked: 1314 times
- Contact:
Re: Make a menu list with Xdialog (Checklist box)
@donkes12
Can't help with your code, but here samples for treeview can be found https://fossies.org/linux/misc/dialog-1.3-20220526.tgz/ (for dialog but often works with Xdialog too), perhaps helpful.
Re: Make a menu list with Xdialog (Checklist box)
Thanks, that was helpful indeed. I've checked examples and figured out that main branch has "0" depth instead of "1". Now it's working, but for some reason branches not being drawn as on treeview demo.
- Attachments
-
- treeview.png (6 KiB) Viewed 2490 times
-
- 1.png (5.96 KiB) Viewed 2490 times
Re: Make a menu list with Xdialog (Checklist box)
@donkes12
Could be a version or GTK thing. I've done other boxes before that did not look exactly like the examples published. I only get the main branches (0 level) to display and not the sub-branches. Can you post the code for your example, please?
Re: Make a menu list with Xdialog (Checklist box)
I was thinking about trying older versions of Xdialog too. But still treeview require a bit more clicks compared to checklist, as I need click to unfold branch, choose sub-branch and then click OK button (double click on selected sub-branch program doesn't fire it up).
Here is the script
Code: Select all
answer=`Xdialog --left --wrap --no-tags --icon /usr/share/pixmaps/wine48.png --stdout --title "Scripts" --treeview "Select your program of choice from the list." 0 0 11 "1" "text" "off" "0" "2" "Spreadsheet32" "off" "1" "3" "Wordpad" "off" "1"`
case /$answer/ in
*/2/*) wine "/initrd/mnt/dev_save/WineProgs/Spreadsheet32/Spread32.exe" & ;;&
*/3/*) wine "/initrd/mnt/dev_save/WineProgs/wordpad.exe" & ;;&
esac
exit
Re: Make a menu list with Xdialog (Checklist box)
donkes12 wrote: ↑Mon Aug 01, 2022 12:23 pmI was thinking about trying older versions of Xdialog too. But still treeview require a bit more clicks compared to checklist, as I need click to unfold branch, choose sub-branch and then click OK button (double click on selected sub-branch program doesn't fire it up).
Here is the scriptCode: Select all
answer=`Xdialog --left --wrap --no-tags --icon /usr/share/pixmaps/wine48.png --stdout --title "Scripts" --treeview "Select your program of choice from the list." 0 0 11 "1" "text" "off" "0" "2" "Spreadsheet32" "off" "1" "3" "Wordpad" "off" "1"` case /$answer/ in */2/*) wine "/initrd/mnt/dev_save/WineProgs/Spreadsheet32/Spread32.exe" & ;;& */3/*) wine "/initrd/mnt/dev_save/WineProgs/wordpad.exe" & ;;& esac exit
Hmm. Still does not work for me with Stretch 7.5 and I copied and pasted your exact code. BTW - With a bit of innovation you can give the checklist and radiolist boxes a treeview look actually by using spaces. This way you will be able to double-click for opening an item and your "tree" will already be expanded. See example attached.
Edit: Treeview does actually work for me as it should. I haven't used it before so I didn't click on the arrows to expand the branch. But as you say, extra clicks with treeview so not really all that convenient.
- Attachments
-
- Screenshot.jpg (24.95 KiB) Viewed 2423 times
Re: Make a menu list with Xdialog (Checklist box)
Great idea, and put inactive entries as separators.
Great thing about Xdialog is that you can replace wine in your case, with rox /path/to/location/ for opening location or geany (or whatever) /path/to/file.ext for firing up some file, etc. And this whole thing is less than 2KB depending on how big is the list. And you can easily customize it to fit your needs, just by editing few text lines.
The only thing difficult is to center the text
- Attachments
-
- 2.png (8.2 KiB) Viewed 2419 times
Re: Make a menu list with Xdialog (Checklist box)
Great thing about the checklist is that you can select several user options for example. I've produced several utilities using this to run through several commands of a script (which could be huge like a remaster script). Check out my utilities (links in my signature).