How does YAD identify the active field in a form dialog?

76 views
Skip to first unread message

robert....@gmail.com

unread,
Jun 26, 2024, 8:02:05 PMJun 26
to yad-common
I'm thinking about adding a button to the bottom of a form dialog ("Show values" in the "Cancel" "OK" row below the entry fields) that opens a second YAD dialog with a list of possible field entries from a text file. I could then select a string from that list, copy it and paste it into a field entry window. The list would be something like an external combo box, but would not automatically add the selected string to the field in the YAD form dialog.

However I would like the "Show values" command to be tied to an individual field, so that if the active field was field 1, for example, the command would call up the appropriate file for field 1. To do this I need to know how YAD identifies the "active" field in a form, in other words the highlighted field with a blinking cursor.

Suggestions welcome!

robert....@gmail.com

unread,
Jun 28, 2024, 3:58:57 AMJun 28
to yad-common
Here's an example of what I'm aiming for. In this case the "Show values" command uses FeatherPad to open a text file, "file1", on my desktop.

yad --form --width="400" --height="400" --field="" --field="" --field="" --button="Show values":"featherpad /home/bob/Desktop/file1" --button=gtk-cancel:1 --button=gtk-ok:0

What I'd like to do is open "file1" with "Show values" when the cursor is in field 1, open "file2" when the cursor is in field 2 and open "file3" when the cursor is in field 3. In other words, the file to be opened depends on the field.


robert....@gmail.com

unread,
Jun 28, 2024, 5:03:50 AMJun 28
to yad-common
OK, I've come up with a workaround:

yad --form --width="400" --height="400"  --columns="2" --field="show values":BTN "featherpad /home/bob/Desktop/file1" --field="show values":BTN "featherpad /home/bob/Desktop/file2" --field="show values":BTN "featherpad /home/bob/Desktop/file3" --field="" --field="" --field=""

This puts a "show values" button (a button field) next to each form entry field, and clicking on the "show values" button launches the appropriate command. In the YAD output, the first 3 results need to be deleted - they're the blank results from clicking on the 3 "show values" buttons!

Reply all
Reply to author
Forward
0 new messages