Page 1 of 1

Change error to warning when OpenWindow() in thread

Posted: Fri Nov 23, 2012 9:56 am
by infratec
Hi,

yes, I use OpenWindow() in a thread.

Why?
I only use it to show a message (like 'Wait a moment'), do some stuff and close it.
This is not possible with the standard MessageRequester() and I don't want API, since this program is
used in Windows and Linux.

Since PB 5.0 it is a bit tricky, since I always have to press 'play' to go on.
A 'warning' would be enough in my opinion, so that the program is still running with debugger on.
(Like for deprecated functions 'CreateGadgetList()' for example)

Bernd

Re: Change error to warning when OpenWindow() in thread

Posted: Fri Nov 23, 2012 10:29 am
by eesau
Why don't you open your window in main and do the other stuff in a thread?

Re: Change error to warning when OpenWindow() in thread

Posted: Fri Nov 23, 2012 10:40 am
by Fred
The problem is it won't work on other OS. For your specific case, you should be able to use a timer, or put DisableDebugger/EnableDebugger around this call (not recommended).

Re: Change error to warning when OpenWindow() in thread

Posted: Fri Nov 23, 2012 10:42 am
by infratec
eesau wrote:Why don't you open your window in main and do the other stuff in a thread?
The overhead is to much.

I start a serial communication thread,
show 'Please do something' and wait with a timeout on the first received bytes.
If I receive them I go on in the thread else I close it.

And I have several different thread procedures which depends on a selectable modul.
Not every modul has the same requierements.
So I put the 'start stuff' inside the thread procedures.

Trust me, the overhead to implement this complete stuff additional in the main program is enormous.

Bernd

Re: Change error to warning when OpenWindow() in thread

Posted: Fri Nov 23, 2012 10:45 am
by infratec
Maybe an other trick is to open the window in the main task and hide it.

Than I show it and hide it inside the thread.
I have to test this.

Bernd

Re: Change error to warning when OpenWindow() in thread

Posted: Fri Nov 23, 2012 10:51 am
by Fred
With 5.10, you will have a PostEvent() command (which can be called from any thread, with a custom event code), so you will be able to ask for the window opening easily.

Re: Change error to warning when OpenWindow() in thread

Posted: Fri Nov 23, 2012 12:43 pm
by jassing
Fred wrote:With 5.10, you will have a PostEvent() command (which can be called from any thread, with a custom event code), so you will be able to ask for the window opening easily.
NICE! (the PostEvent())

I second the 'warning' on openwindow vs. error.

Re: Change error to warning when OpenWindow() in thread

Posted: Fri Nov 23, 2012 4:48 pm
by sec
5.0 will go to 5.10? Or 5.1, 5.2 ....?
Thanks

Re: Change error to warning when OpenWindow() in thread

Posted: Fri Nov 23, 2012 5:39 pm
by ts-soft
sec wrote:5.0 will go to 5.10? Or 5.1, 5.2 ....?
Thanks
It is 5.00, after 5.00 comes next major 5.10, but often comes some bugfix Releases
as 5.01, 5.02 or 5.11 without new Features.

Re: Change error to warning when OpenWindow() in thread

Posted: Fri Jan 24, 2014 2:24 pm
by Mistrel
This change broke some of my code. I actually used this feature where I require windows to have independent message queues.

Add a note in the documentation but don't remove features that have been around forever!