Problem with --form and value from pipe

213 views
Skip to first unread message

Wolfgang Stey

unread,
Nov 14, 2021, 3:57:08 AM11/14/21
to yad-common
Good Morning,
I have a problem with the following code:
-------------Code-begin----------------
#! /bin/bash
export MeinKanal=$(mktemp -u --tmpdir meika.XXXXXXXX)
mkfifo "$MeinKanal"
trap "rm -f "$MeinKanal"" EXIT
KindId=$(($RANDOM * $$))
#----------------------Funktionen---------
function berechnen
{
x=2000
y=1000
xn=$((x/100*$Wert))
yn=$((y/100*$Wert))
}
#----------------Ende Funktionen-------------------
exec 8<> "$MeinKanal"
export -f berechnen

#yad --plug="$KindId" --tabnum=3 --scale --text="Werte in %" &

yad --plug="$KindId" --tabnum=1 --scale --text="Werte in %" --print-partial --value=50 --min-value=0 --max-value=100 | \
while read -r Wert; do
berechnen $Wert
echo "$xn ""$yn" > "$MeinKanal" 
done &

yad --plug="$KindId" --tabnum=2  --form  --cycle-read \
--field="Berechnete Werte":RO <&8 &
#--field="Schieber 2":scl 20 & \

yad --paned --key="$KindId" --button="gtk-ok:0" --button="gtk-quit:1" --borders=10 --geometry=300x300 \
    --title="test"
exec 8>&-
--------------------------------Code-End---------------------------
The results of a calculation are displayed in the RO field, but if I add another field to the --form it no longer works. In this case the default value of 20 is in the RO field
Does anyone have any idea how to solve this.
Thanks very much
greeting
wolfgang

Victor Ananjevsky

unread,
Nov 18, 2021, 3:59:16 AM11/18/21
to yad-c...@googlegroups.com
hi

initial values for form must be specified for all fields
so, this code must work (i hope)

yad --plug="$KindId" --tabnum=2 --form --cycle-read \
--field="Berechnete Werte":RO 'r/o value' \
--field="Schieber 2":scl 20 & \

also you must pass values for all fields in form into the pipe

В Sun, 14 Nov 2021 00:57:08 -0800 (PST)
Wolfgang Stey <wolf...@gmail.com> пишет:

Wolfgang Stey

unread,
Nov 19, 2021, 5:41:31 AM11/19/21
to yad-c...@googlegroups.com
Hello Victor,
thank you for your message. I know that all fields have to be pre-assigned, but in my case the content that comes via the pipe is not displayed after the pre-assignment. Yad behaves as if I have not created a default.
Is there a way to display the content of the pipe, even if the field is preset.
thanks
wolfgang

yad --plug="$KindId" --tabnum=2  --form  --cycle-read \
  --field="Berechnete Werte":RO 'r/o value' <&8 \  <----??
  --field="Schieber 2":scl 20 & \

-------- Weitergeleitete Nachricht --------
Von: Victor Ananjevsky <vic...@sanana.kiev.ua>
Betreff: Re: [yad] Problem with --form and value from pipe
Datum: Thu, 18 Nov 2021 11:00:11 +0200

Милош Павловић

unread,
Nov 19, 2021, 10:02:39 AM11/19/21
to yad-common
You need to pass the first value to the pipe, the scale does not print out until the slider is moved.

{ echo 50; yad --plug="$KindId" --tabnum=1 --scale --text="Werte in %" --print-partial --value=50 --min-value=0 --max-value=100; } | \
while read -r Wert; do
berechnen $Wert
echo "$xn ""$yn" > "$MeinKanal"
done &

Милош Павловић

unread,
Nov 19, 2021, 8:07:47 PM11/19/21
to yad-common
Sorry wolfgang, I didn't understand at first.
something like this will do

Wolfgang Stey

unread,
Nov 19, 2021, 11:04:46 PM11/19/21
to yad-c...@googlegroups.com
Hello Viktor, 
many, many thanks.
Your solution works perfectly. 
Thanks! wolfgang

-------- Weitergeleitete Nachricht --------
Von: Милош Павловић <mpsr...@gmail.com>
An: yad-common <yad-c...@googlegroups.com>
Betreff: [yad] Re: Problem with --form and value from pipe
Datum: Fri, 19 Nov 2021 17:07:47 -0800 (PST)
--
You received this message because you are subscribed to a topic in the Google Groups "yad-common" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/yad-common/Wwfxj0uJunQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to yad-common+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/yad-common/47a0a418-ed48-47dc-a8c6-0b8cfaf32284n%40googlegroups.com.

Wolfgang Stey

unread,
Nov 20, 2021, 2:42:23 PM11/20/21
to yad-c...@googlegroups.com
Hello Viktor, 
I have another question in this context. 
Is it possible to send the values ​​of a "scl" field to a pipe from a form object. 

Example cutout:
....
{ echo "50" ; yad --plug="$KindId" --tabnum=1 --form --text="Werte in %" --print-partial \
--field="Schieber1":scl 20 ;} | \
while read -r Wert; do
berechnen $Wert...

greeting wolfgang

-------- Weitergeleitete Nachricht --------
Von: Милош Павловић <mpsr...@gmail.com>
An: yad-common <yad-c...@googlegroups.com>
Betreff: [yad] Re: Problem with --form and value from pipe
Datum: Fri, 19 Nov 2021 17:07:47 -0800 (PST)

--

Милош Павловић

unread,
Nov 22, 2021, 5:48:45 AM11/22/21
to yad-common
I'm not Victor or Viktor. :D
Currently only a button can send a field value %N to a pipe from a form dialog.
yad --form --field="1":scl 20 --field="Apply:"BTN "echo %1"

Miloš
Reply all
Reply to author
Forward
0 new messages