Sign in Join

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

Mailing lists / lazarus / 2011-07

0019723: Implement TControl.InvalidateRect?

5 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Martin

http://bugs.freepascal.org/view.php?id=19723

It would be nice to have TControl.InvalidateRect, so that component developers can avoid calls to LCLIntf.InvalidateRect :-)

---

Show quoted text 6 lines
Zeljan Rikalo <mailto:> (developer) Not problem with implementing that, but one can say we can implement almost all winapi functions into TControl to avoid LCLIntf usage. I'm not against adding InvalidateRect(R: TRect) into TControl, but there must be agreement from other devels about it

There is the question of drawing a lie, to how much to put on TWinControl. There are more Handle related functions... So there could be an additional HandleObject property, with an object representing the handle. Though, IMHO that would be too much...

What is the specific use case for it?
I can only really see use, if you develop your own component. But then you can add it there...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110715/41380047/attachment.html>

Reply by email

Flávio Etrusco
to Martin

2011/7/15 Martin :

Show quoted text 25 lines
http://bugs.freepascal.org/view.php?id=19723 It would be nice to have TControl.InvalidateRect, so that component developers can avoid calls to LCLIntf.InvalidateRect :-) --- Zeljan Rikalo (developer)? Not problem with implementing that, but one can say we can implement almost all winapi functions into TControl to avoid LCLIntf usage. I'm not against adding InvalidateRect(R: TRect) into TControl, but there must be agreement from other devels about it There is the question of drawing a lie, to how much to put on TWinControl. There are more Handle related functions... So there could be an additional HandleObject property, with an object representing the handle. Though, IMHO that would be too much... What is the specific use case for it? I can only really see use, if you develop your own component. But then you can add it there... --

The intended use is for component developers, yes. But actually I thought about it while checking a bug report and having to offset for InvalidateRect with a TPaintBox, so I'd prefer it was implemented in TControl ;-) It's just a matter of extract the method from TContol.Invalidate.
I guess it's impossible to draw line, they need to be indeed discussed on a case-by-case basis. That's why I posted the RFE as a question ;-)

Best regards,
Fl?vio

Reply by email

Martin
to Flávio Etrusco
Fl?vio Etrusco wrote 5 lines
2011/7/15 Martin: > http://bugs.freepascal.org/view.php?id=19723 > > It would be nice to have TControl.InvalidateRect, so that component > developers can avoid calls to LCLIntf.InvalidateRect :-)

...

Show quoted text 18 lines
> There is the question of drawing a lie, to how much to put on TWinControl. > There are more Handle related functions... So there could be an additional > HandleObject property, with an object representing the handle. > Though, IMHO that would be too much... > > > What is the specific use case for it? > I can only really see use, if you develop your own component. But then you > can add it there... > > -- The intended use is for component developers, yes. But actually I thought about it while checking a bug report and having to offset for InvalidateRect with a TPaintBox, so I'd prefer it was implemented in TControl ;-) It's just a matter of extract the method from TContol.Invalidate. I guess it's impossible to draw line, they need to be indeed discussed on a case-by-case basis. That's why I posted the RFE as a question ;-)

Well, one other think is, the current function would still have to remain. (or compatibility would be broken badly).
So doing this would simply be a duplicate.

I am definitely with the comment on mantis. I wouldn't want to add to many more things to T(Win)Control. That would speak for a TWinControl.HandleObj.InvalidateRect(x,y,x2,y2)

I do see the point of wanting to access it in context of a T(Graphic)Control, but there is no handle. there could be a handle object; but it probably wouldn't work for all functions...

Also TGraphicControl, and TCustomControl(inherit TWinControl) introduce a Canvas, maybe then it could go there?
TCanvas, has other handle related functions, like GetClipRect.

Just some ideas....

Reply by email

Martin
to Flávio Etrusco: 2011/7/15 Martin : The intended use is for component developers, yes. But actually I…
Fl?vio Etrusco wrote 5 lines
2011/7/15 Martin: > http://bugs.freepascal.org/view.php?id=19723 > > It would be nice to have TControl.InvalidateRect, so that component > developers can avoid calls to LCLIntf.InvalidateRect :-)

....

Show quoted text 5 lines
The intended use is for component developers, yes. But actually I thought about it while checking a bug report and having to offset for InvalidateRect with a TPaintBox, so I'd prefer it was implemented in TControl ;-) It's just a matter of extract the method from TContol.Invalidate.

BTW, you realize, that if your intend is to minimize the invalidated rectangle, to what needs to be redrawn, then a TGraphicControl (or any none TWinControl) is not your best choice anyway?

At least on windows, but maybe others, if you put to TGrapicControl onto the same TWincontrol, and then you invalidate a one pixel rectangle in each of them, then this will invalidate ONE BIG rectangle containing both pixels.

So the point of having/using InvalidateRect for a none TWinControl is rather limited.

Reply by email

Flávio Etrusco
to Martin: ... Well, one other think is, the current function would still have to remain. (or…
Martin wrote 55 lines
On 15/07/2011 20:33, Fl?vio Etrusco wrote: > > 2011/7/15 Martin: >> >> http://bugs.freepascal.org/view.php?id=19723 >> >> It would be nice to have TControl.InvalidateRect, so that component >> developers can avoid calls to LCLIntf.InvalidateRect :-) ... >> >> There is the question of drawing a lie, to how much to put on >> TWinControl. >> There are more Handle related functions... So there could be an >> additional >> HandleObject property, with an object representing the handle. >> Though, IMHO that would be too much... >> >> >> What is the specific use case for it? >> I can only really see use, if you develop your own component. But then >> you >> can add it there... >> >> -- > > The intended use is for component developers, yes. But actually I > thought about it while checking a bug report and having to offset for > InvalidateRect with a TPaintBox, so I'd prefer it was implemented in > TControl ;-) It's just a matter of extract the method from > TContol.Invalidate. > I guess it's impossible to draw line, they need to be indeed discussed > on a case-by-case basis. That's why I posted the RFE as a question ;-) Well, one other think is, the current function would still have to remain. (or compatibility would be broken badly). So doing this would simply be a duplicate. I am definitely with the comment on mantis. I wouldn't want to add to many more things to T(Win)Control. That would speak for a TWinControl.HandleObj.InvalidateRect(x,y,x2,y2) I do see the point of wanting to access it in context of a T(Graphic)Control, but there is no handle. there could be a handle object; but it probably wouldn't work for all functions... Also TGraphicControl, and TCustomControl(inherit TWinControl) ?introduce a Canvas, maybe then it could go there? TCanvas, has other handle related functions, like GetClipRect. Just some ideas.... --

My thought of declaring in TControl is it would be just a matter of changing InvalidateControl (sorry for the typo in my previous post): From:
procedure TControl.InvalidateControl(CtrlIsVisible, CtrlIsOpaque: Boolean); To:
procedure TControl.InvalidateControlRect(CtrlIsVisible, CtrlIsOpaque: Boolean; const ABounds: TRect);

then replace the call to Self.Bounds to ABounds, and add a new InvalidateControl calling InvalidateControlRect.

BTW, you realize, that if your intend is to minimize the invalidated rectangle, to what needs to be redrawn, then a TGraphicControl (or any none TWinControl) is not your best choice anyway?

Yes, but since we have TPaintBox which is a hack, maybe we can complement the hack ;-)

-Fl?vio

Reply by email