Jump to content

Create frame in thread


Mike

Recommended Posts

Hi,

 

Is it possible to create a frame in a thread and after it is created place it on a panel in the mainform?

 

Because there are lot of controls and data queries it takes a long time to show so to prevent the user is waiting I would like to test if it can be done in the background.

Link to comment
Share on other sites

I tried the following but it gets an Access violation error.

     TThread.CreateAnonymousThread(
            procedure
            var
              FrameView : TfraFrameView;
            begin
              FrameView := TfraFrameView.Create(Self);
              TThread.Synchronize(TThread.Current,
                procedure
                begin

                  with FrameView do
                  begin
                    Parent := NewPage;
                    Align := alClient;
                    pgctrlMain.ActivePage := NewPage;
                    FrameView.Show;

                  end;

               end);

            end
          ).Start;

Any idea what could be wrong?

Link to comment
Share on other sites

Hi Mohammad,

 

Because the frame contains a lot of queries and grids it takes some time to build up (direct after login).

 

Instead of keep the user waiting it is done in the background.

 

Therefore I would like to see if this can be done in a thread.

 

Could you explain what you mean by user session is already thread of uniGUI application? I don't understand.

Link to comment
Share on other sites

The form is loaded first and after that there is an ajax call to fill the grid with dat.

what do you mean by 'many grids and queries' maybe you should separate them in multiple frames/forms.

a screenshot or image would help you much more  ;)

Link to comment
Share on other sites

I have decided to leave it this way. The customer finds the loading time acceptable.

 

With many grids and queries I mean dbgrids and queries which are created at runtime (depending of values in tables).

 

Unfortunately I can't show screenshots.

 

Thanks for your time!

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...