Sign in Join

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

Mailing lists / lazarus / 2011-01

LCL-fpGUI widgetset and COM interfaces

9 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Graeme Geldenhuys

Hi,

While looking at the LCL-fpGUI code for a reply to a previous message, I noticed something...

Is it really necessary for LCL-fpGUI to use COM-style interfaces? After all, TFGGUIPrivate overrides the COM memory management anyway. So wouldn't it be better and probably more efficient to simply use CORBA-style interfaces instead?

I'm not well versed in the LCL-fpGUI widgetset code, so if there really is an advantage to using COM-style interface in this widgetset, would somebody so kind as to explain those advantages. Many thanks.

---8<-----------8<-----------8<-----------8<-----------8<----------- ?
type

  IContainer = interface(IInterface)
    procedure AddChild(AWidget: TfpgWidget);
    procedure RemoveChild(AWidget: TfpgWidget);
  end;
  TFPGUIPrivate = class(TInterfacedObject)
    function _AddRef : longint;stdcall;
    function _Release : longint;stdcall;
  end;

?
---8<-----------8<-----------8<-----------8<-----------8<-----------

Regards,
- Graeme -

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

Reply by email

José Mejuto
to Graeme Geldenhuys

Hello Lazarus-List,

Monday, January 10, 2011, 2:27:02 PM, you wrote:

GG> I'm not well versed in the LCL-fpGUI widgetset code, so if there really GG> is an advantage to using COM-style interface in this widgetset, would GG> somebody so kind as to explain those advantages. Many thanks.

As one of the last commiters :) I can only say that "I do not know", just simply use whatever done in code and try to expand and adapt it as much as possible. Currently the lack of regions in fpGUI (At least I had not found them) is driving me crazy, but that's the "funny" thing :)

Best regards, Jos?

Reply by email

Graeme Geldenhuys
to José Mejuto

Op 2011-01-10 16:08, Jos? Mejuto het geskryf:

As one of the last commiters :) I can only say that "I do not know", just simply use whatever done in code and try to expand and adapt it as much as possible.

OK thanks. Maybe one of the other LCL-fpGUI commiters will comment further.

Currently the lack of regions in fpGUI (At least I had not found them) is driving me crazy, but that's the "funny" thing :)

Not sure what that has to do with my original question, but I'll try and answer.

Do you mean methods like the following:

  TfpgBaseCanvas = class(?)
    ?
    procedure   SetClipRect(const ARect: TfpgRect);
    function    GetClipRect: TfpgRect;
    procedure   AddClipRect(const ARect: TfpgRect);
    procedure   ClearClipRect;
    ?
  end;

If not, then what is the difference between regions and clip rectangles? Where, or for what, would you use regions?

Regards,
- Graeme -

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

Reply by email

José Mejuto
to Graeme Geldenhuys

Hello Lazarus-List,

you wrote
> Currently the lack of regions in fpGUI (At least > I had not found them) is driving me crazy, but that's the "funny" > thing :)

GG> Not sure what that has to do with my original question, but I'll try and GG> answer.

Nothing, just bring to my mind as I'm working on it right now :)

GG> Do you mean methods like the following:
GG>   TfpgBaseCanvas = class(
)
GG>     procedure   SetClipRect(const ARect: TfpgRect);
GG>     function    GetClipRect: TfpgRect;
GG>     procedure   AddClipRect(const ARect: TfpgRect);
GG>     procedure   ClearClipRect;
GG>   end;
GG> If not, then what is the difference between regions and clip rectangles?
GG> Where, or for what, would you use regions?

A region is more complex, it could have rectangles or any kind of path, so for WinAPI compatibility I had created a simple workaround for rectangles (as far as I know LCL only uses rectangles) and to operate them because you can add cliprects but you can not read the cliprect if it is a combination of two rects.

I'm not using regions, is LCL which use them (testing TLabel). Anyway this is becoming off topic ;)

Best regards, Jos?

Reply by email

Graeme Geldenhuys
to José Mejuto

Op 2011-01-10 17:02, Jos? Mejuto het geskryf:

A region is more complex, it could have rectangles or any kind of path, so for WinAPI compatibility I had created a simple workaround for rectangles (as far as I know LCL only uses rectangles)

Yes, I just searched the LCL help, and it mentions that it only supports rectangle regions.

operate them because you can add cliprects but you can not read the cliprect if it is a combination of two rects.

Ah, now I understand the problem. I've added it to my todo list. Thanks for explaining.

Regards,
- Graeme -

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

Reply by email

Felipe Monteiro de Carvalho
to Graeme Geldenhuys: Op 2011-01-10 16:08, Jos? Mejuto het geskryf: OK thanks. Maybe one of the other LCL-fpGUI…
Graeme Geldenhuys wrote
OK thanks. Maybe one of the other LCL-fpGUI commiters will comment further.

I started this widgetset interface, but back then I didnt use any interface, so probably someone in the middle between me and Jos? Mejuto added the COM interfaces. For me it makes no difference, it can be changed to CORBA interfaces or even removed if appropriate.

Felipe Monteiro de Carvalho

Reply by email

Graeme Geldenhuys
to Felipe Monteiro de Carvalho

Op 2011-01-11 14:21, Felipe Monteiro de Carvalho het geskryf:

I started this widgetset interface, but back then I didnt use any interface, so probably someone in the middle between me and Jos? Mejuto added the COM interfaces.

I did a quick history search on my git repository. That file in question (and that bit of code) was added by Mattias in r10901 (2007-04-06), but not sure if he created it, or simply applied someone else's patch.

Regards,
- Graeme -

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

Reply by email

Vincent Snijders
to Graeme Geldenhuys

2011/1/11 Graeme Geldenhuys :

Show quoted text 8 lines
Op 2011-01-11 14:21, Felipe Monteiro de Carvalho het geskryf: > I started this widgetset interface, but back then I didnt use any > interface, so probably someone in the middle between me and Jos? > Mejuto added the COM interfaces. I did a quick history search on my git repository. That file in question (and that bit of code) was added by Mattias in r10901 (2007-04-06), but not sure if he created it, or simply applied someone else's patch.

I think it is related to r10899.

Vincent

Reply by email

Graeme Geldenhuys
to Vincent Snijders

Op 2011-01-11 14:44, Vincent Snijders het geskryf:

I think it is related to r10899.

Ah yes, I now remember Andrew working on LCL-fpGUI (wow, was it that long ago). Thanks for the info Vincent.

Andrew Haines, are you still here? If so, mind commenting on my original question?

Regards,
- Graeme -

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

Reply by email