Keep dialog open after clicking Cancel or OK?

448 views
Skip to first unread message

FFRR

unread,
Mar 16, 2016, 7:00:59 AM3/16/16
to yad-common
HI

I have a confirmation dialog I wish to run as a check for the user before they close it.

Can't really use field buttons on the starting dialog due to layout, so how do I keep the dialog open and have the confirmation dialog pop up above it

e.g.
(first-one.sh)
#!/bin/bash
yad
--form --text "First dialog" --title "FIRST-ONE"


ret
=$?


if [[ ret == 1]] then
      confirm
.sh
fi
(needs to stay open after OK button click, can close on Cancel)

(confirm.sh)
#!/bin/bash
yad
--text "Are you sure you want to quit?" --title "CONFIRM" --on-top


ret
=$?


if [[ ret == 1]] then
      wmctrl
-c "FIRST-ONE"
fi
(If OK closes first-one, if Cancel, return to first-one - which is still open)


Or have I missed something?

Thanks

Tim

Victor Ananjevsky

unread,
Mar 16, 2016, 7:19:41 AM3/16/16
to yad-c...@googlegroups.com
#! /bin/bash

function confirm_exit
{
yad --text "Are you sure?"
[[ $? -eq 0 ]] && kill -USR1 $YAD_PID
}
export -f confirm_exit

yad --form --field "data" --button "gtk-close:bash -c confirm_exit"


В Wed, 16 Mar 2016 04:00:59 -0700 (PDT)
FFRR <carte...@gmail.com> писал:
> --
> You received this message because you are subscribed to the Google Groups "yad-common" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to yad-common+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


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

Tim Carter

unread,
Mar 16, 2016, 8:41:28 AM3/16/16
to yad-c...@googlegroups.com
Excellent, thank you Victor :)

I didn't realise I could add a function/command to dialog buttons, this will make a big difference going forward.

Tim 

Julio C. Neves

unread,
Mar 16, 2016, 10:06:30 AM3/16/16
to yad-c...@googlegroups.com
Bom dia Tim,
Hope this can be usefull for you:

while :
do
    yad --form --text "First dialog" --title "FIRST-ONE" \
        || yad --text "Are you sure you want to quit?" --title "CONFIRM" --on-top \
        && break
done

Abcs,
Julio
@juliobash


--

FFRR

unread,
Mar 16, 2016, 9:12:18 PM3/16/16
to yad-common
Thanks Julio very useful too :)

Tim
Reply all
Reply to author
Forward
0 new messages