Frederick Posted March 2, 2022 Share Posted March 2, 2022 As I click the menu items in the tree menu, what control(s) should I put in Area A so that a different TUniDBGrid is shown. Since each TUniDBGrid uses a different query, should I open and close the query as the grid is shown and hidden or should I open all queries at the start of the program. I am thinking in the interest of memory usage. Area A is currently a TUniContainerPanel. -- Frederick (UniGUI Complete - Professional Edition 1.90.0.1558) treemenu.mp4 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 2, 2022 Share Posted March 2, 2022 22 minutes ago, Frederick said: As I click the menu items in the tree menu, what control(s) should I put in Area A so that a different TUniDBGrid is shown. Since each TUniDBGrid uses a different query, should I open and close the query as the grid is shown and hidden or should I open all queries at the start of the program. I am thinking in the interest of memory usage. Area A is currently a TUniContainerPanel. Hello, Well, it all depends on the task (by the count of data displayed) I think... Quote Link to comment Share on other sites More sharing options...
Frederick Posted March 2, 2022 Author Share Posted March 2, 2022 2 hours ago, Sherzod said: Hello, Well, it all depends on the task (by the count of data displayed) I think... I think the number of records for the grid could be up to 300. Quote Link to comment Share on other sites More sharing options...
Point Posted March 3, 2022 Share Posted March 3, 2022 hi Frederick, Put unicontainer, panel or pagecontrol on area A, then embed a form or aframe, use create an release's technique to reduce memory usage. for example like this : AForm := TUniForm1.Create(UniSession.uniApplication) AForm.parent := unicontainer1; AFrame := TUniForm1.Create(MainForm) AFrame.parent := panel1; //uniTabsheet1; Quote Link to comment Share on other sites More sharing options...
Frederick Posted March 3, 2022 Author Share Posted March 3, 2022 Hi Point, I plan to use a pagecontrol in area A and create individual forms containing grids. Can I assign an existing form's parent to the pagecontrol's tabsheet when a menu item in the tree menu is selected and then set the form's parent to NIL when another menu is selected? Will this method reduce memory use? Quote Link to comment Share on other sites More sharing options...
Point Posted March 3, 2022 Share Posted March 3, 2022 as long as dataset put on a form's created, i think will reduce memory. Quote Link to comment Share on other sites More sharing options...
Frederick Posted March 3, 2022 Author Share Posted March 3, 2022 Thank you for the pointers! Quote Link to comment Share on other sites More sharing options...
Point Posted March 3, 2022 Share Posted March 3, 2022 i am not so fluent in english, let video talk 🙂. here my project using page control and load a form on it. hope it can inspire you. Quote Link to comment Share on other sites More sharing options...
Frederick Posted March 3, 2022 Author Share Posted March 3, 2022 Your English is just fine and your application is very nice! Thank you. Quote Link to comment Share on other sites More sharing options...
Frederick Posted March 3, 2022 Author Share Posted March 3, 2022 I am not sure what I am doing wrong but the forms are not displaying inside the TUniTabSheet of the TUniPageControl. I have two application forms and my code when each TUniMenuItem is clicked is:- procedure TMainForm.mnu1Click(Sender: TObject); var cMenu : String; begin cMenu:=treMenu.SourceMenu.Items[treMenu.Selected.Id].Name; if assigned(oForm) then oForm.Close; oForm:=NIL; if cMenu='mnu1' then begin oForm:=frmForm1; end else if cMenu='mnu2' then begin oForm:=frmForm2; end; if assigned(oForm) then oForm.Parent:=tab1; end; However, the application forms are displayed outside the main form. What could be the problem? parentoftab.mp4 Quote Link to comment Share on other sites More sharing options...
donlego Posted March 3, 2022 Share Posted March 3, 2022 2 hours ago, Point said: i am not so fluent in english, let video talk 🙂. here my project using page control and load a form on it. hope it can inspire you. sample project_edit_x264.mp4 Bro kalo boleh tau pake theme apa itu ya 😁 Quote Link to comment Share on other sites More sharing options...
Point Posted March 3, 2022 Share Posted March 3, 2022 me 3 minutes ago, donlego said: Bro kalo boleh tau pake theme apa itu ya 😁 pake tema gerhadv, tapi css-nya banyak saya custom. Quote Link to comment Share on other sites More sharing options...
Point Posted March 3, 2022 Share Posted March 3, 2022 1 hour ago, Frederick said: I am not sure what I am doing wrong but the forms are not displaying inside the TUniTabSheet of the TUniPageControl. I have two application forms and my code when each TUniMenuItem is clicked is:- procedure TMainForm.mnu1Click(Sender: TObject); var cMenu : String; begin cMenu:=treMenu.SourceMenu.Items[treMenu.Selected.Id].Name; if assigned(oForm) then oForm.Close; oForm:=NIL; if cMenu='mnu1' then begin oForm:=frmForm1; end else if cMenu='mnu2' then begin oForm:=frmForm2; end; if assigned(oForm) then oForm.Parent:=tab1; end; However, the application forms are displayed outside the main form. What could be the problem? parentoftab.mp4 you must create a form like i wrote above. here the clue : 1. use free form 2. global variable for a form (must thread safe variable) 3. release form's variable when you load another form 4. pure OOP, to avoid memory leak. use : override and virtual method Quote Link to comment Share on other sites More sharing options...
Frederick Posted March 3, 2022 Author Share Posted March 3, 2022 I created two free forms giving them each a name of frmFree1 and frmFree2 respectively. if cMenu='mnu1' then begin oForm:=frmFree1; // Compiler chokes here and says "Undeclared Identifier frmFree1" end else if cMenu='mnu2' then begin oForm:=frmFree2; // Compiler chokes here and says "Undeclared Identifier frmFree2" end; even when the units for the two forms are in the Uses clause. I can't create the free form dynamically because I need to design the form itself with controls and components there. I'll need to research further since I have never used free forms in UniGUI before. Quote Link to comment Share on other sites More sharing options...
Point Posted March 3, 2022 Share Posted March 3, 2022 Sorry, I have to take the video down, there is private data. I made the application for the government Quote Link to comment Share on other sites More sharing options...
Point Posted March 4, 2022 Share Posted March 4, 2022 On 3/3/2022 at 12:04 PM, Point said: hi Frederick, Put unicontainer, panel or pagecontrol on area A, then embed a form or aframe, use create an release's technique to reduce memory usage. for example like this : AForm := TUniForm1.Create(UniSession.uniApplication) AForm.parent := unicontainer1; AFrame := TUniForm1.Create(MainForm) AFrame.parent := panel1; //uniTabsheet1; corrected : AFrame := TUniFrame1.Create(MainForm) AFrame.parent := panel1; //uniTabsheet1; Quote Link to comment Share on other sites More sharing options...
Frederick Posted March 4, 2022 Author Share Posted March 4, 2022 2 hours ago, Point said: corrected : AFrame := TUniFrame1.Create(MainForm) AFrame.parent := panel1; //uniTabsheet1; Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.