v1cont / yad

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

Combine FBTN with CB with columns=2? #130

Open frostworx opened 3 years ago

frostworx commented 3 years ago

Currently, I use the main buttons on the bottom for calling internal functions Those buttons use space of course, so the minimal width of some windows is already too big. Now I wonder if combining a :FBTN with a:CB "live" using columns=2 could work somehow (so basically as an alternative for a :FCB)

Mockup example: yad --form --columns=2 --field="Function":CB "function1\!function2\!function3" --field="Execute":FBTN "bash -c $SELECTION_FROM_CB_FIELD" (When clicking Execute the Function is supposed to be started at once - optional closing the current window would be great)

I'd like to avoid having to choose a function in :CB and launch it with a regular bottom button, because this would be confusing. Using multiple :FBTN would be not the best solution in this case, because this specific window is supposed to be as comprehensible as possible.

Would be great if someone could help

v1cont commented 3 years ago

is that what you want?

#! /bin/bash

function hndl {
    echo "Choosed function - $1"
    kill -USR2 $YAD_PID
}
export -f hndl

yad --button="yad-close:1" --use-interp --form --columns=2 \
    --field="Function":CB "function1\!function2\!function3" \
    --field="Execute":FBTN "hndl '%1'"
frostworx commented 3 years ago

Wow, thank you very much, that is exactly what I wanted! I already solved my initial problem, by moving all functions as buttons into my main menu, but it is great to know, that this function is already available, and I will make use of it for sure :) I hope my questions are not too annoying, but I really could not find this anywhere (either it is hidden pretty good or I have serious search problems :)) Thank you very much for your continuous help!