On Sun, 19 Mar 2006 13:47:01 -0300
"Flávio Etrusco" <[EMAIL PROTECTED]> wrote:
> On 3/19/06, Mattias Gaertner <[EMAIL PROTECTED]> wrote:
> > On Sun, 19 Mar 2006 06:08:31 -0300
> > "Flávio Etrusco" <[EMAIL PROTECTED]> wrote:
> >
> > > Hi,
> > >
> > > Is there some reason why the 'Interfaces' unit isn't used (declared in
> > > the 'uses' clause) in Controls.pp or Forms.pp? (so that one wouldn't
> > > need to declare it in the .lpr - and so that if a lose the declaration
> > > somehow in the lpr I wouldn't scratch my head for hours trying to
> > > guess why WidgetSet is nil ;-) :-$
> >
> > If I remove the 'interfaces' unit I get the error:
> >
> > ERROR: No widgetset object. Plz check if the unit "interfaces" was added
> > to the programs uses clause.
>
> Yeah, I only realized what was going on when I saw this error message...
> Unfortunately this isn't working when you are using SynEdit (I didn't
> try to understand where this verification is done or why it isn't
> working, though).
> SynTextDrawer calls IsDBCSLeadByte which access WidgetSet and this
> doesn't trigger that message if WidgetSet isn't set.
>
> > Interfaces is the LCL interface - a widgetset.
> > If you want to know, what 'interfaces' does, just Ctrl+Click on the unit
> > and the IDE will show you a short unit with one important statement:
> >
> > WidgetSet:= TGTKWidgetSet.Create;
>
> Yeah, being the curious guy I am of course I read the file as soon as
> the message showed ;-)
> I've read something about it in the wiki entry about conversion from
> Delphi to Lazarus, but this still wouldn't explain that I needed to
> use it in my .lpr and why I have to.
>
> > I wonder, why you searched for hours.
>
> I may be exagerating a bit ;-)
> But my question remains: why doesn't Forms or Controls use it already
> (since they will certainly neeed it) so one didn't have to "use" it
> explicitly?
Forms and Controls only 'use' the abstract LCL interface.
By using the 'interfaces', you add a real LCL interface.
The LCL interfaces use the LCL, not the other way round.
Some LCL objects must be initialized before others. So there must be one
root unit. For the LCL, this is the 'interfaces' unit.
Mattias
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives