Welcome! Log In Create A New Profile

Advanced

loading a window in background

Posted by Noel Tanti 
Noel Tanti
loading a window in background
November 26, 2014 09:05AM
Hi All

I need to load a window in the background without using the main thread but need this window to remain active.

Any idea how to achieve this.
Thanks

Noel
Charles U. Schneiter
Re: loading a window in background
November 26, 2014 10:01AM
Hi Noel,

I am sure, other - more savvy WinDev'ers - will chime in, but anyway:

How about creating an Internal Window Control and assigning your 'persistent' window by ChangeSourceWindow() to it.

By having different planes in it, you can hide this window from view by switching to another plane.
This persistent window will still be 'active' and can thus react to other events (Internal Windows are not closed, they are just hidden from view ...

Dont know if that's of any help though
Arie
Re: loading a window in background
November 26, 2014 10:21AM
OpenSister() or OpenChild()?
If you explain a bit more about why you need this, we can give you some more ideas...
Noel Tanti
Re: loading a window in background
November 26, 2014 10:54AM
Sorry should have explained more...

I am using a remote server and the query displaying a list of records is ok. However when I open a form to edit or create a record, I get a time delay ranging from 2 to 8 seconds. This is a bit too muchespecially for a busy period.

I took Fabrice's advice and am opening a window in a thread however if I open the window in the main thread I get the same problem, and if I start off another thread the window closes when the thread finishes.

I need a way to load a form in a background thread and keep the form from closing when the thread finishes.

No sure if this is clear enough.

Thanks
Noel
Arie
Re: loading a window in background
November 26, 2014 11:18AM
Ok,
in these cases I do NOT bind the table control, which shows al your records, to the query.
Instead I fill the table control by programming.
Then whenever you change a record in a separate window, and come back from it, use the SAME query with an extra searchparameter (ie ParamID) to get just the modified record(s). And then just modify the corresponding line(s) in your tablecontrol. That should be fast enough I guess.

This will avoid the complexity of threads or independant open windows.
Fabrice Harari
Re: loading a window in background
November 26, 2014 11:38AM
Hi Noël,

To achieve what you are describing, this is what I do:
- I have a first/main window always open, and always invisible, with no control or menu in it
- this window is in charge of ONE thing, opening all the other windows using openchild
- when a secondary window needs a tertiary window, it does NOT open it, instead, it asks the main window to do it


So in your case, you would have the main window opening your query window (with an openchild), then opening any number of form windows in advance and outside screen (with openchild, again)

When your query window needs a form window, it asks the main window for it , and this window makes it visible.

Of course, the main window always keeps track of what is open where, and manage the whole "needed in advance" openings and of course the cleaning after too.


I have built some pretty complex UI with this system, with tons of free floating windows, dockings, multiple sets of windows (desktops), etc

Best regards
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: