v1cont / yad

Yet Another Dialog
GNU General Public License v3.0
654 stars 58 forks source link

Read FL type field without closing the form #220

Open VlaSard opened 1 year ago

VlaSard commented 1 year ago

How can I pass the data from the file selection field to the function for the next processing, without closing the window. A CB type field can be passed, but this does not work for a FL type field.

The code that was used

export out=$(mktemp /tmp/q.XXXXXX)
export pipe3="/tmp/$$"
mkfifo $pipe3

trap "rm -f $pipe3 $out" EXIT

tests() { # test function
  NAMES=$(cat $out | tail -1 )
  yad --text="$NAMES" --button="Stop:0"
}
export -f tests

changed() {
  echo "$2"  >>$out
}
export -f changed

yad \
  --form \
  --field=$"signal\t:CB" "FILES1\!FILES2\!FILES3" \
  --field=$"delay\t:NUM" $NUMBERS!1..100 \
  --use-interp \
  --changed-action="changed" \
  --button=$"Test:tests" \
  --button=$"Start:0" \
  --button=$"Cancel:1" &
YAD_PID=$!

tail --pid=$YAD_PID -f $pipe3 > $out
v1cont commented 1 year ago

this is impossible right now. --changed-action available only for switchers like checks or combo boxes. i'll think about extend this feature to other filed types in future releases.

as a workaround you may use :btn or :fbtn fields to launch action without closing form