[Lazarus] Calling DrawFocusRect() outside the Paint() event

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Mon Oct 10 11:21:48 CEST 2016


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?

On a side note:
  The Paint() event for the report designer can potentially have very
lengthy code, so we definitely don't want to repaint everything simply
because we are dragging a focus rectangle around on the canvas. So if we
must, we can obviously work around this by using various states in the
Paint method.


fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal

My public PGP key:  http://tinyurl.com/graeme-pgp

More information about the Lazarus mailing list