Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
6
Erster Beitrag:
vor 3 Jahren, 7 Monaten
Letzter Beitrag:
vor 3 Jahren, 7 Monaten
Beteiligte Autoren:
RAUL2, Fabrice Harari

Solved [WD] Reference to a TPLC_xxxx from inside

Startbeitrag von RAUL2 am 14.10.2014 23:57

Hi!

I need to use EnumControls() from a local proc inside a control template. Problem is that in design-time the TPLC has a name (let's say "TPLC_calculator"), but in run-time, the container for the TPLC may have another name (let's say "CTPL_MyCalc").

Until now, I can't find a way to make a reference to that object without its name. I also tried indirection but I can't make it run. It's pretty simple:


sAuxControl= EnumControl(TPLC_Calculator, i) // Works fine if I press F9 while designing the control, but doesn't work in run-time.


In old Visual FoxPro, this was really simple:


oTPLC= TPLC_Calculator
sAuxControl= EnumControl(oTPLC, i)


The oTPLC variable is an object type variable, so, there's no problem at all. How do I do this in WD?

Kind regards.

Antworten:

Re: [WD] Reference to a TPLC_xxxx from inside

Hi Raul

I think that you are looking for "MyWindow"

Best regards

von Fabrice Harari - am 15.10.2014 09:52

Re: [WD] Reference to a TPLC_xxxx from inside

Hi Fabrice. Well, I've tried MyWindow and MySelf too, but it doesn't work.

The local proc is executed from a button code and for that reason, if I issue MySelf, the reference is the button, not the TPLC.

If I issue MyWindow, WD says that the object isn't the container (I don't remember the exact words in the message window), and WD is right! Because it make reference to the window containing the TPLC.

I've also tried ParentObject(), but it returns the window, not the TPLC.

I don't find any way else to make reference to the TPLC from within!

Regards.

von RAUL2 - am 15.10.2014 11:37

Re: [WD] Reference to a TPLC_xxxx from inside

Hi again

MyWindow gives you the window... Enum allows to enumerate everything in it, INCLUDING your control... Once you are on your control, you can enumerate what's within it

Again, that is if I understand correctly the problem

von Fabrice Harari - am 15.10.2014 11:48

Re: [WD] Reference to a TPLC_xxxx from inside

Thanks for your replies. You understood correctly the problem. I think your remark is the solution, I just didn't want to do that, thinking there should be any other way simplier.

This kind of stuff should be easier! Anyway...

Best regards and thank you.

von RAUL2 - am 15.10.2014 13:06

Re: [WD] Reference to a TPLC_xxxx from inside

Hi! I've found another way (I think it's easier...)

In TPLC global declarations I create a string var.
In TPLC Init I set the var to the plain name of the TPLC (extractstring in myself..fullname prop.)
Later, I use indirection with the var.

Doing this, the code in TPLCs are independent of the control's name.

Best regards.

von RAUL2 - am 15.10.2014 14:03
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.