[lazarus] create

Sergio A. Kessler sak at perio.unlp.edu.ar
Tue May 18 19:44:19 EDT 1999


"Baeseman, Cliff" <Cliff.Baeseman at Greenheck.com> el día Tue, 18 May 1999 
18:01:04 -0500, escribió:

>Well we have two options for the create component thing. One is to use the
>construct that we are using and
>the other is to pass the widget assignment up to fcomponent from the
>implementation level such as in TCustomMemo.Create. The one we are using
>allows us to add the widgets in one central location vs many units.

Cliff, in open source proyects centralizing things is a bad idea...
Suppose that I want to add a component, why I must modify other code
that is running smoothly.
Suppose that I want to develop a commercial component, the user must
modify their source code ?
Suppose now that we have thousands of components, every time I create
one, the code must flow an overloaded case struct ?
If there is a problem in one component, just look at that component,
not anything else.
I don't need syncronization with others developers when I'm creating
components.

In a ideal situation of Open Source all must be a plug-in, this is
what Gimp creators have done (because the authors couldn't mantain
all the code) and why Gimp is so wonderfull.

Of course talking about plug-ins in this stage is useless, but,
please, let's descentralize.

>Two different approaches which is correct. The one we have specified here
>makes it easier to build compound objects based from many different widgets
>such as in the TMemo implementation without including units.

with my aproach we can do exactly the same without any problem,
suppose that I want to do a OpenDialog that consist in a gtk_window
and a gtk_file_selection inside, then you declare two components
and map the calls to the corresponding one.
Even the gtk allow this, from what I understand you can even put a
gtk_window inside a gtk_button

>
>????
>
>Cliff
>
>
>-----Original Message-----
>From: Sergio A. Kessler [mailto:sak at perio.unlp.edu.ar]
>Sent: Tuesday, May 18, 1999 5:15 PM
>To: Lazarus mailing list
>Subject: [lazarus] create
>
>
>
>Hey, what the heck is this ?
>
>Procedure TControl.CreateComponent(AOwner : TComponent);
>...
>case fCompStyle of
>
>csAlignment: Begin
>		fComponent := gtk_alignment_new(0.5,0.5,0,0);
>		gtk_widget_show(fComponent);
>       	     end;
>
>csButton: begin
>   fComponent := gtk_button_new_with_label('Button');
>   gtk_object_set_data(GTK_OBJECT (fComponent), PChar(Name), fComponent);
>   end;
>...
>
>this should be managed by the components themselves, if
>not every time we add a widget, we need to modify this
>thingy.
>And every time we create a widget, the code should traverse
>this code, slowing downs things without need.
>
>it shouldn't be:
>
>constructor TCustomForm.Create(AOwner : TComponent);
>begin
>inherited Create(AOwner);
>
>+  fComponent := gtk_window_new( GTK_WINDOW_DIALOG);
>+  // set the window policies 
>+  gtk_window_set_policy (GTK_WINDOW (fComponent), 1, 1, 0);
>+  gtk_window_set_title(pGtkWindow(fComponent),'Caption');
>
>  If AOwner = nil then
>     fCompStyle := csMainForm
>     else
>     fCompStyle := csForm;
>   Top := 1;
>   Left := 1;
>   Width := 120;
>   Height := 120;
>     	  Writeln('CreateComponent being called for TFORM');
>	  CreateComponent(AOwner);
> { Assign  Signals }
>   AssignOnDestroy;
>   AssignOnShow;
>   AssignOnFocus;
>   AssignOnResize;
>end;
>
>the same with Destroy
>
>TipNote: try to use // comments in one line comments, sometimes I want
>to comment a block and I found nested comments in the hard way  :)
>
>Sergio
>
>_________________________________________________________________
>     To unsubscribe: mail lazarus-request at miraclec.com with
>                "unsubscribe" as the Subject
>    archives at http://www.miraclec.com/list_archives/lazarus
>
>_________________________________________________________________
>     To unsubscribe: mail lazarus-request at miraclec.com with
>                "unsubscribe" as the Subject
>    archives at http://www.miraclec.com/list_archives/lazarus






More information about the Lazarus mailing list