Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
5
Erster Beitrag:
vor 11 Monaten, 2 Wochen
Letzter Beitrag:
vor 11 Monaten, 2 Wochen
Beteiligte Autoren:
Paul Turner, Fabrice Harari, Peter Holemans

WD20, 'Element unknown' error

Startbeitrag von Paul Turner am 14.12.2016 06:36

I've started getting the following error

'WIN_Subcontractor_Selection' element unknown.

in the following code

sWindow is string = "WIN_Subcontractor_Selection"
stResource is stSubcontractor_Resource = Open({sWindow,indWindow},passed_SubcontractorID,passed_Type,passed_Job_Details)

which is in a class.

The element WIN_Subcontractor_Selection is present as a Window in the project, but for some reason is not visible to the class.

However this code does work:

stResource is stSubcontractor_Resource = Open(WIN_Subcontractor_Selection,passed_SubcontractorID,passed_Type,passed_Job_Details)

Anyone have an idea how to get the indirection version to work?

Rgds
Paul Turner

Antworten:

Hi Paul,

I might be wrong, but according to me you don't need to use indirection in this case.
You can simply do:

stResource is stSubcontractor_Resource = Open(sWindow,passed_SubcontractorID,passed_Type,passed_Job_Details)


Q&Tip:
Is this a class managing your GUI only?
If it is part of the pure 'Resource' entity business logic I would not call GUI elements out of it since it will limit portability of that business logic to other environments like WB, WM or web services later on.

Cheers,

Peter Holemans

von Peter Holemans - am 14.12.2016 08:46
Hi

"open" accepts either the window or a string containing it's name.
Indirection operators returns the CONTENT, at the time of execution, not the container (ie not the name of the window, which is already in your string).

Therefore, indirection SHOULD NOT be used in an open.

Best regards

von Fabrice Harari - am 14.12.2016 09:38
Thanks Peter

von Paul Turner - am 14.12.2016 21:47
Thanks Fabrice

von Paul Turner - am 14.12.2016 21:47
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.