Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 5 Jahren, 2 Monaten
Letzter Beitrag:
vor 5 Jahren, 2 Monaten
Beteiligte Autoren:
Aad Gouka, Yogi Yang, Alexandre Leclerc

WD17 - Components and variables.

Startbeitrag von Aad Gouka am 05.06.2013 11:46

Hi all,

I'm experimenting with components a little. Variables of the components are "seen" by the
main program. Variables of the main program are not "seen" by the component. Is there a way to solve this ?

Thanks for any help.

Best regards,

Aad Gouka


Hi Aad,

This is the normal behaviour of a component. The best you can do it telling the component that it is using the same analysis. But as far as the scope of variable, the component is not able to see the main program's variable. (Because it must work independently and not depend of the main program.)

Some strategies can be used to access the main program. Like having a callback function where the component asks the main program the value of a given variable. Or sharing some classes or collection of procedure (having them in a third component to share between many components). Exchanging information with the help of common classes or structures, etc. (Similar to the previous technique.)

The goal of a component is to make a piece of software fully reusable as-is (so independent in functioning) in other software / website, provided it uses the same analysis if the analysis is shared.

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 05.06.2013 12:23
I would suggest you to add properties to your component which a developer should set with the values from global variables or better still create one single property in your component that accepts an array and hosting program should pass the necessary values in that array to your component.

Just my idea!

von Yogi Yang - am 05.06.2013 13:30
Hi Alexander,
Thank you for your excellent explanation.

Yogi Yang,
Thanks also for your input, I'll give it a try.

Kind regards,

Aad Gouka

von Aad Gouka - am 05.06.2013 15:36
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.