yad --form --field=Button:BTN

3,263 views
Skip to first unread message

stretchedthin

unread,
Sep 8, 2011, 2:48:20 AM9/8/11
to yad-common
I was hoping make a tutorial on YAD for youtube. Been going through
the different field options and it's been going pretty well but I've
stumbled a bit on this one .
yad --form --field=Button:BTN
I get a button, but I don't know how to write the line so that
pressing the button generates some standard output to the terminal.
Would really like pressing the button to do something.
Thanks in advance.

Victor Ananjevsky

unread,
Sep 8, 2011, 4:10:33 AM9/8/11
to yad-c...@googlegroups.com
В Wed, 7 Sep 2011 23:48:20 -0700 (PDT)
stretchedthin <ken2...@gmail.com> писал:

try this:
yad --form --field=Button:BTN 'echo "button pressed"'

an initial value for button field is a command which launched when button pressed

--
Victor Ananjevsky <anan...@gmail.com>

slo.sleuth

unread,
Sep 12, 2011, 2:23:50 PM9/12/11
to yad-c...@googlegroups.com
Victor, can the field button command be a function of the same script calling yad --form?  I can't seem to get it to work with internal functions, but works fine with external commands.

Victor Ananjevsky

unread,
Sep 13, 2011, 12:25:50 AM9/13/11
to yad-c...@googlegroups.com

yes, it can. just export a function and use it as "bash -c function_name"
for example:

#! /bin/bash

function on_click () {
echo clicked
}
export -f on_click

yad --form --field "Button:BTN" "bash -c on_click"

--
Victor Ananjevsky <anan...@gmail.com>

slo.s...@gmail.com

unread,
Sep 15, 2011, 10:51:16 AM9/15/11
to yad-c...@googlegroups.com
Thanks Victor, I should have thought of that.
Reply all
Reply to author
Forward
0 new messages