0

During Working with yad --form displayed some |||(vertical bars) after clicked a button, what are this bars indicating & how I can STOP them to display? Providing sample code, You can experience

yad --width=400 --height=200 --button="gtk-ok" --form --field="Click Down":LBL "echo Clicked" --field="Click HERE":BTN

Result output will be " Clicked then ||

0

I cannot reproduce the situation you describe entirely, but I think you need to ask yourself what you want yad to do when a button is pressed, or, more specifically, how yad should communicate any user choice back to you, i.e. via an exit code or via information on standard output.

The option --button="gtk-ok" creates a button that is not tied to an exit code with which yad can exit and silently let you know that this particular button was pressed. Consequently, it seems, it will try to inform you via output on stdout (printing two default output separator characters). To prevent this, you could rephrase the option, e.g. like so:

--button="gtk-ok":1

which ties an exit code of 1 to pressing the OK button, and prevents further output. At the command prompt (or in a script), you can test this exit code, which is available as $?.

Importantly: note that the yad manpage indicates that the proper syntax for the `--button'-option is:

--button=BUTTON:ID
Add the dialog button. May be used multiply times. ID is an exit code or a command. (...)

So the option `--button="gtk-ok" seems to be syntactically incorrect.


To get the behaviour your describe, I had to change --field="Click Down":LBL "echo Clicked" into --field="Click Down":BTN "echo Clicked".


All in all, the following command works as expected on my system:

yad --width=400 --height=200 --button="gtk-ok":1 --form --field="Click Down":BTN "echo Clicked" --field="Click HERE":BTN
  • ozzy, as you said by set gtk-ok":1 ,I skipped ||||||(vertical bars), but when I set gtk-ok:2 again I got vertical bars, In my bash script yad comes 3 times continuously and interesting point is whenever gtk-ok:EVEN NUMBER then I got vertical bars. Is there any special relation with even number ? – AlphaCoder Jan 6 at 5:16
  • I Just skipped All vertical bars by setting ODD NUMBERS, So Why EVEN? – AlphaCoder Jan 6 at 5:26
  • @AlpaCoder In the yad manpage, under EXIT CODES, it says “Even exit code mean to print result, odd just return result”. So this behaviour is apparently by design. – ozzy Jan 6 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.