PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [VERY easy] variables and objects referencing
[VERY easy] variables and objects referencing
Iniciado por ferrid, 07,jun. 2016 16:25 - 2 respuestas
Miembro registrado
19 mensajes
Publicado el 07,junio 2016 - 16:25
hello from Italy and sorry for my very bad english

I have 2 questions and I hope somene can help me

1) is possible to have a "calculated reference" to the name
of an object or a variable? I try to explain better:
on a Windows I have 16 buttons called "BTN_BUTTON1",
"BTN_BUTTON2" and so on
I want to "turn off" or "turn on" ALL the buttons and my
idea is something like this
FOR x = 1 to 16
BTN_BUTTON&x = off
END
Obviously the second line is uncorrect, but I wrote it
just to give the idea (in many languages I know how to
"point" to a value calculating the variable name with a
formula)

is this possible? or have you a better idea to suggest?

2) is possible to know, in a procedure, the name of the
"calling button"?
in the above example: all my 16 buttons call the same
routine and is enough, for me, to "read" the numerical
index in the button name

thanks to everybody

Daniele, a true beginner
Publicado el 07,junio 2016 - 17:56
Hello,

1) You can use indirection or create a group in the window (right click in the control and select the option 'Groups'). Then use (the control name using indirection / group name)..state = grayed; (example: BTN_BUTTON2..state = grayed or {"BTN_BUTTON"+i,indcontrol}..state = grayed.

2) CurrentField()?

Hope it helps.

Bruno
Publicado el 07,junio 2016 - 20:29
Hi Daniele,

yes, and yes :-)

1. Look in the help for INDIRECTION

2. Look in the help for the dbgxxxx family of functions

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

More information on http://www.fabriceharari.com