PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → How to set property of a template control from inside template code.
How to set property of a template control from inside template code.
Iniciado por PaulGruet, 22,oct. 2019 10:17 - 2 respuestas
Publicado el 22,octubre 2019 - 10:17
Hi ,

I am having a struggle with Control Templates and wonder if anyone can see what I am doing wrong.

I would like to be able to set a property of the template from inside a local procedure belonging to that template but this seems impossible. I can set properties of the component controls but not the template itself. For example in the template TPLC_MyTemplate this local procedure works:

PROCEDURE ShowEditField()

EDT_Field..Visible = true

However this gives an error at compile time even though the type-ahead prompts in the editor suggests it is valid:

PROCEDURE ShowControl()
TPLC_MyTemplate..Visible = true

I have also tried
PROCEDURE ShowControl()
Self..Visible = true

but get the same error. Am I missing something obvious here or is this a limitation of control templates?

Thanks

Paul
Miembro registrado
52 mensajes
Publicado el 23,octubre 2019 - 14:39
I think I know what you mean:

you want to change template properties from within controls of this template, so you must make this template to "remember" itself, so the best aproach I see is this

at GLOBAL DECLARATIONS OF TPLC_MYTEMPLATE
Template_Name is string = MySelf..Name


then at whatever event or proccess inside your template code you can use:

{Template_Name,indControl}..Visible=False


hope to be useful
Publicado el 24,octubre 2019 - 09:31
thank you that's just what I was looking for
Paul