[Lazarus] Calling DrawFocusRect() outside the Paint() event
zeljko at holobit.net
Mon Oct 10 13:11:03 CEST 2016
On 10/10/2016 11:21 AM, Graeme Geldenhuys via Lazarus wrote:
> Working on a visual report designer for the upcoming fpReport. We use
> Canvas.DrawFocusRect() to draw a selection rectangle around a reporting
> element (eg: a memo). We can drag that rectangle around in the report
> designer (which itself is a custom widget). We call the
> Canvas.DrawFocusRect() from within the MouseMove event. It seems to work
> fine under LCL-GTK2, but could this be problematic on other platforms,
> as painting outside the Paint event can normally have undefined results.
> Or has LCL somehow resolved the issues of painting outside the Paint event?
No, carbon, cocoa and qt widgetset (qt on all platforms) cannot paint
outside of paint event.
FocusRect(s) can be saved in an object or array of focus TRectangles,
Update() or Update(RectToBeUpdated) can be called from MouseMove, and
then in paint method paint saved FocusRect(s).
More information about the Lazarus