73 views
in System Integration by

Hi,

 

In out program, we must be able to generate PDF files with measurement data, we do this in the CPP code in a separate thread. 

For these PDF files we need to have translated texts and we would like to get those using the translatable strings from Embedded Wizard.

What is the best way to do this?

 

Met vriendelijke groet/with kind regards/mit freundlichen Grüßen/Avec la salutation aimable/Saygilanmizla/Barati udvozlettel/Saludos/敬具/Veliki pozdrav, मित्रत पुर्ण अभिवादन, با  حترام,

 

Karijn Wessing
Sr. Software Engineer
Edwards Lifesciences Holding B.V.
karijn_wessing@edwards.com
www.edwards.com

1 Answer

0 votes
by

Hello Karijn,

your question is not really clear for me. I will answer it more generally. 

Embedded Wizard generates C code in files with file extension *.c. This code can be accessed from C++ if necessary.

By setting the profile attribute OutputFileNameExtension to the value cpp the generated files will have the file extension *.cpp. Your compiler will treat them as C++ files. The content of the files is still C code, but now you can implement C++ code in native sections and in this manner permit GUI to access C++ functionality.

I hope it helps you further.

Best regards

Paul Banach

by
Hi Paul,

Let me explain a little more.

We already have some translated strings in the UI, in Embedded Wizard. It is working perfectly. Now we would like to access some of those strings inside our code, in C++, so that we can use them in a generated PDF file.

There is this function in EW api we could use:

EwGetVariantOfString

It builds nicely. But, when we call it, we get "EMWI ERROR: code: 395"

Because the functions are not thread safe, and we are not in the same thread as the UI.

So, how can we access the generated strings from other levels of code, in different threads?

 

Best regards,

Gunseli
by
Hello Gunseli,

as explained in the error message the code has to be executed in context of the GUI thread. You will need to implement a kind of communication between the PDF and GUI thread, so that the PDF thread sends a request to the GUI thread to query a string.

Depending on the amount of strings, it may be more simple to manage the affected strings directly in C++.

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...