[Lazarus] When do I need a component rather than a plain object?

Graeme Geldenhuys graemeg.lists at gmail.com
Tue Nov 16 16:26:25 CET 2010


Op 2010-11-16 16:39, Michael Van Canneyt het geskryf:
> 
> The problem is moot in fpGUI, it doesn't have a TImage component.

Yes, yes, and takes all of two minutes to implement, if really needed. :)
In the case of fpGUI, I haven't yet had such a need. With fpGUI Designer
having the ability to drop any "unknown" widget on a form (that's any
TfpgWidget descendant that's not registered in the component palette), and
being able to setup properties for that widget even though it is "unknown",
I had no need to implement a dedicated TImage type component yet.

It's similar to me not seeing the point of the various "Dialog" (file open,
font select, color select etc) components on the component palette - it's
equally easy using them directly in code when needed. There is no advantage
of having design time support for those - in fact it just uses extra memory
when you do.

If you really want a TImage style component, all you had to do was ask and
I would have implemented it :)  Either way, I'll implement one just just
for you (though it might be a bit later I guess). ;-)


> Drawing an image must be done manually using Canvas.Draw, so a
> hypothetical IDE for it must not worry about it  :-)

But image selection is still required (and possible in fpGUI) for other
components that display images. eg Buttons.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net:8080/fpgui/





More information about the Lazarus mailing list