Mike Posted April 15, 2018 Share Posted April 15, 2018 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 More sharing options...
mhmda Posted April 15, 2018 Share Posted April 15, 2018 Sure, Use classic VCL way Link to comment Share on other sites More sharing options...
Mike Posted April 16, 2018 Author Share Posted April 16, 2018 Thanks. Good to know. Can uniThreadtimer be used for this purpose? Link to comment Share on other sites More sharing options...
Mike Posted April 16, 2018 Author Share Posted April 16, 2018 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 More sharing options...
mhmda Posted April 16, 2018 Share Posted April 16, 2018 Why do you use thread? the user session is already thread of unigui application. could you explain the logic or the idea of what you want to do. Link to comment Share on other sites More sharing options...
Mike Posted April 17, 2018 Author Share Posted April 17, 2018 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 More sharing options...
mhmda Posted April 17, 2018 Share Posted April 17, 2018 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 More sharing options...
Mike Posted April 18, 2018 Author Share Posted April 18, 2018 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 More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now