Page 1 of 1

Trigger UI redrawing?!

Posted: Tue Oct 30, 2018 12:44 pm
by JasonMiles
Hi,
I have a rather long running / command that raises some click events (script.raise_event).
These events cause some UI elements to be drawn, created, closed, ...

As everything happens in one command/function it looks like there is no UI update until the very end.

I would like to see the steps in between though (simply to make it visually followable).

Question: Is there a way to trigger a redraw of the UI via script?
I couldn't find an event to raise or a way to let the script run "asynchronous".

Or is this actually the case already and I'm just to slow/the runtime is not long enough yet?

Thanks

P.S. my search foo returned nothing the like, if this question has been answered already then I'm sorry :)

Re: Trigger UI redrawing?!

Posted: Tue Oct 30, 2018 12:51 pm
by DaveMcW
I think the UI only draws once per tick. So you will have to break up your command into multiple function calls, probably using script.on_nth_tick() to coordinate them.

Re: Trigger UI redrawing?!

Posted: Tue Oct 30, 2018 9:54 pm
by JasonMiles
Okay, thanks.

I was afraid this was the answer :)
Off to creating a scheduler and some locking logic then :D

Re: Trigger UI redrawing?!

Posted: Thu Nov 01, 2018 8:25 am
by Klonan
I believe, if you add a `player.show_message_dialog()` function between each addition of the GUI, you will be able to see it being built 1 piece at a time

Re: Trigger UI redrawing?!

Posted: Mon Nov 19, 2018 1:04 pm
by JasonMiles
Awesome, thanks :)
I'll try that out.

Re: Trigger UI redrawing?!

Posted: Mon Nov 19, 2018 7:12 pm
by JasonMiles
Follow up question.
If I use the dialog it actually blocks UI rendering. Is there a way to programmatically close it again?
Because otherwise the user has to manually proceed for every step.
Or am I missing something?

Re: Trigger UI redrawing?!

Posted: Tue Nov 20, 2018 10:24 am
by Klonan
JasonMiles wrote: Mon Nov 19, 2018 7:12 pm Follow up question.
If I use the dialog it actually blocks UI rendering. Is there a way to programmatically close it again?
Because otherwise the user has to manually proceed for every step.
Or am I missing something?
I thought you would use it for visual debugging only

What is the exact problem you are having with the GUI?