177 views
in GUI Development by
Hi!

I call a native function to print my data (around 10000 data). While it is printing, I want a loader message to be displayed in screen. In my design, it is first printing the data and them display the loader screen. Is there any way to achieve this simultaneously happen while it prints at the backend and display the loader in screen?

Thank you.

Regards,

Thanushiyah

1 Answer

0 votes
by

Hello Thanushiyah,

I see two possibilities:

Option 1: Display first the loader screen and after a short delay start printing the data. The delay is necessary to ensure that the system has enough time to completely display the screen before the printing data will block the processing. To achieve the delay you can use e.g. a Timer object.

Option 2: Print the data in small chunks. Instead of implementing a for-loop to iterate over the 10000 data values, implement a slot method which prints only one value. Each time the slot method is executed, the next value should be printed. That means you will need to manage a counter, etc. inside the slot method to remember which is the next value to print. Then trigger the slot method using idlesignal statement, for example when you display the loader screen you also idlesignal the slot method. This will have the effect of the slot method being execute after the next screen update. To continue running the slot method, just ensure that the implementation of the slot method ends also with an idlesignal statement referring the slot method itself. In this manner the method will trigger itself endlessly. This however, without blocking the GUI because the execution of the slot method is deferred thanks to idlesignal.

I hope it helps you further.

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

...