Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-02

Component Writing Question For Lazarus

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Justin Smyth

I've got a simple question , i want to write a component that has two or more other components on it ( ie a text box or or a button and a image ) on it , should i be using a widget to do this ? or should i just write it directly ( i've written components for lazarus before but can only get one control on it ) the platform i will be using will be Win32 ( i want to convert some other components that i have that have more than one graphical control on them so far i havent been sucessfull doing it )

Any help would be great

Delphian

ik
to Justin Smyth
Justin Smyth wrote 10 lines
I've got a simple question , i want to write a component that has two or more other components on it ( ie a text box or or a button and a image ) on it , should i be using a widget to do this ? or should i just write it directly ( i've written components for lazarus before but can only get one control on it ) the platform i will be using will be Win32 ( i want to convert some other components that i have that have more than one graphical control on them so far i havent been sucessfull doing it ) Any help would be great

You need a container for it such as TWinControl or something like that (see TCustomPanel or something like that) that can have child component inside, and by code you place the other components inside.

You can see the TLabelEdit for example of two components inside one.

Show quoted text 9 lines
Delphian _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Ido

Justin Smyth

----- Original Message -----

Earlier message 36 lines
From: Justin Smyth To: ik Sent: Thursday, February 04, 2010 11:35 PM Subject: Re: [fpc-pascal] Component Writing Question For Lazarus Yes thats what i'd figured i would do and have my different components as TControl ( as i found out when i looked at how TCustomUpDown did it - which used TCustomControl as the base class ) My Question Really is i see these components in lazarus using widgets ( WSRegisterClass ) - i am new this i am not sure if need it etc ( and if i do i am not sure how i go about doing the bit my own Register<MyComponentName> as found in WSRegisterClass ) Delphian ----- Original Message ----- From: ik To: Justin Smyth ; FPC-Pascal users discussions Sent: Thursday, February 04, 2010 11:13 PM Subject: Re: [fpc-pascal] Component Writing Question For Lazarusi\ On Thu, Feb 4, 2010 at 14:01, Justin Smyth wrote: I've got a simple question , i want to write a component that has two or more other components on it ( ie a text box or or a button and a image ) on it , should i be using a widget to do this ? or should i just write it directly ( i've written components for lazarus before but can only get one control on it ) the platform i will be using will be Win32 ( i want to convert some other components that i have that have more than one graphical control on them so far i havent been sucessfull doing it ) Any help would be great You need a container for it such as TWinControl or something like that (see TCustomPanel or something like that) that can have child component inside, and by code you place the other components inside. You can see the TLabelEdit for example of two components inside one. Delphian
Paul Ishenin
to Justin Smyth: I've got a simple question , i want to write a component that has two or more other…
Justin Smyth wrote 8 lines
I've got a simple question , i want to write a component that has two or more other components on it ( ie a text box or or a button and a image ) on it , should i be using a widget to do this ? or should i just write it directly ( i've written components for lazarus before but can only get one control on it ) the platform i will be using will be Win32 ( i want to convert some other components that i have that have more than one graphical control on them so far i havent been sucessfull doing it )

First of all you are using the wrong mail list. And this cause you have less answerts you could get.

Regards your question I suggest to look at TEditButton component - it consists of TEdit and TButton (with image). I don't see what do you mean by directly but there are somw ways to implement your task.

First - is to use TEdit and TButton internally. Second to use TCustomControl and implement drawing, mouse, keyboard handling yourself. The third way is to write your control using windows handles instead of TEdit and TButton directly (not desired way since it is not cross-platform). Everything is similar to how you would do thin in Delphi.

Best regards,
Paul Ishenin.