CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Sat Dec 16, 2017 5:48 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Fri Dec 01, 2017 1:47 pm 
Offline

Joined: Tue Dec 10, 2013 9:00 am
Posts: 23
I try to use VisuElems.cmpDynamictext.DynamicTextGetTextW function to read a text from text list.
In my project I noticed that it returns pointer to "" until I add a Visualization and select a language in the Visualization Manager. Then it works.

But my problem is I would like to use the function in a library and call it from inside the library.
The function called from inside a library always returns non-zero pointer.
I suspect this is because of language (I may be wrong), because for the library no language is selected.
I tried to set a language with VisuElems.cmpDynamictext.DynamicTextChangeLanguage function, but without success.
Does anyone have an idea how to resolve it?


Top
   
PostPosted: Fri Dec 01, 2017 5:13 pm 
Offline

Joined: Tue Dec 03, 2013 11:52 pm
Posts: 47
From past experience when no "language" is selected I had to call DynamicTextGetDefaultTextW instead of DynamicTextGetTextW.


Top
   
PostPosted: Mon Dec 04, 2017 10:45 am 
Offline

Joined: Tue Dec 10, 2013 9:00 am
Posts: 23
Thank you for your reply, Comingback4u.

I have tried both functions (DynamicTextGetTextW and DynamicTextGetDefaultTextW), but both of them return pointer to an empty string.
Strangely, I noticed that if I put the text list in my project rather than in the library, then the functions call from the library return correct text.
I also called VisuElems.CURRENTLANGUAGE and DynamicTextGetCurrentLanguage functions inside the library and they both seem to have a correct language selected (same as in the project).
So my understanding now is: there is a problem with accessing/receiving the text from the text list from inside the library, because the text list placed in the project works.

I still do not know how to resolve it though.


Top
   
PostPosted: Mon Dec 04, 2017 9:05 pm 
Offline

Joined: Tue Dec 03, 2013 11:52 pm
Posts: 47
I have not tried it in a library but can you check to see if the textlist is being put onto the device? The textlist might be adding the library name before it and can verify that by looking in the visu folder. For example you might need to call "library.txtlistname" instead of just "txtlistname". Just a thought.


Top
   
PostPosted: Thu Dec 07, 2017 9:37 am 
Offline

Joined: Tue Dec 10, 2013 9:00 am
Posts: 23
Comingback4u wrote:
(...) The textlist might be adding the library name before it and can verify that by looking in the visu folder. For example you might need to call "library.txtlistname" instead of just "txtlistname". Just a thought.

That was exactly what happened!
I had to add the library namespace before text list name, as the library adds its prefix with dot.
That resolved the problem.
Thank you very much for your support!


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 5 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited