Jean-Marc Kiener Posted September 1, 2016 Share Posted September 1, 2016 Hi folks, I try to set AutoEdit property of one or more TDatasource located on a TUniFrame. I tryed following code below but ControlCount is always 0. procedure TMyFrame.UniFrameCreate(Sender: TObject); var i: integer; begin for I := 0 to self.ControlCount -1 do begin if TComponent( self.Controls[I] ) is TDatasource then begin TDatasource( self.Controls[I] ).AutoEdit := UniServerModule.AUTOEDIT; end; end; end; Any ideas? Link to comment Share on other sites More sharing options...
Jean-Marc Kiener Posted September 1, 2016 Author Share Posted September 1, 2016 I moved all TDatasource components to the TDatamodule unit. Now i can do it like this: for I := 0 to self.ComponentCount -1 do begin if self.Components[I] is TDatasource then begin TDatasource( self.Components[I] ).AutoEdit := UniServerModule.AUTOEDIT; end; end; That seems to work. What is the right approach to locate a TDatasource on a Unigui project? Till now i placed the TDatasource on a TUniFrom or TUniFrame and the database components (Connection, Querys) on TUniMainModule or a TDatamodule. Cheers Jean-Marc Link to comment Share on other sites More sharing options...
Jean-Marc Kiener Posted September 1, 2016 Author Share Posted September 1, 2016 Ah, i saw that i also can do the same on the TuniFrame. Still my question: TDatasource on TUniFrame or TUniManimodule/TDatamodule? Link to comment Share on other sites More sharing options...
md9projetos Posted September 1, 2016 Share Posted September 1, 2016 I think the reason why the vast majority of uniGuiers place teh datasources in the forms is just scalability, For me their places are the DataModule. but I think saving some bytes won´t pay the price of coding maintanance,and its up to you to close your datasets when they´re not needed anymore. And scalability can be reached by using load balancing. Scalability was once a big problem in uniGui,but the components have been rewritten and Delphi 64 bits have pushed the limits. How many simultaneous users are your application going to have? People soemtimes scare about a scalability that will never happen,ERP systems should never be multi-tenant. Link to comment Share on other sites More sharing options...
Jean-Marc Kiener Posted September 1, 2016 Author Share Posted September 1, 2016 In my case here there TDatasource.OnStateChange is heavely used to enable/disable visual components. That's the reason why it is located on the TuniFrame instead of the TUniMainmodule or TDataModule. Or is there a proper way to set Properties of visual unigui controls on a form from TUniMainmodule? Link to comment Share on other sites More sharing options...
md9projetos Posted September 1, 2016 Share Posted September 1, 2016 uniGui is server centric,its no more than a Delphi DLL version ,so I don´t think it is anything different than you did in a traditional Delphi system. are you using ClientDatasets,If don´t you probably should. Or the FireDac Memtables. Link to comment Share on other sites More sharing options...
md9projetos Posted September 1, 2016 Share Posted September 1, 2016 Forget about: The Datasource should be in the forms. I was thinking about the TDatasets,I don´t know many people put them on the forms. I usually put the ClientDatasets and the Datasources on the forms. Take a look also at this one that can help you: http://forums.unigui.com/index.php?/topic/4654-10-general-design-questions/ Link to comment Share on other sites More sharing options...
Jean-Marc Kiener Posted September 2, 2016 Author Share Posted September 2, 2016 Thanks to md9projetos for the helpful answers. Link to comment Share on other sites More sharing options...
md9projetos Posted September 4, 2016 Share Posted September 4, 2016 Kiener look at this one: http://forums.unigui.com/index.php?/topic/290-datasources-in-uniframes/ this message is very old,so something could have changed. I don´t use frames only forms,thats why i created JAUD(based on perjanbr desktop3),I would like to know the advantages of using frames,because probably there are,the majority of uniGuiers use them. If its just scalability its a question of design,for me scalability is a non functional requirement,that can be achieved by load balancing,and t never sacrifice user experience,and almost never code maintanability. So I´m really evaluating if i´m going to use frames or forms. But for those who want to migrate their applications using a parser/importer ,probably things like JAUD will be an easier path. But it is a difficult subject,when change your design or not to meet non-fucntional requirements,I myself hate ORM I think they kill scalability, user experience in order to gain code maintanability(at least some people think it is). Marcello Update:I decided to use frames for the details in master detail relationships(those that the user will sometimes be interested,sometimes not),and for all content that will be in the page,but taht can be showed only after a user clicks in a button. 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