Jump to content

Catch all TDatasource components on a TUniFrame


Jean-Marc Kiener
 Share

Recommended Posts

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

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

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

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

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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...