6

I'm creating some custom FireMonkey GUI controls. The components need to update in response to user interactions. VCL controls can call Invalidate() to be placed into a queue for repainting. Does FireMonkey have an equivalent method?

FireMonkey controls have a Repaint() method, but AFAICT that forces the control to be repainted immediately. A queue type system would be more appropriate in some circumstances.

Shannon Matthews
  • 9,649
  • 7
  • 44
  • 75
  • I haven't used XE2 yet, but I assume there must be something like "scene|object.refresh|redraw" –  Dec 07 '11 at 04:22
  • 4
    TControl.Realign fits more because most of the time there is no direct drawing in FMX controls, as they are made of primitive. If you call Realign, primitives will be redrawn – az01 Dec 07 '11 at 16:19
  • http://stackoverflow.com/questions/8411143/firemonkey-controls-do-not-animate-smoothly – Shannon Matthews Oct 10 '13 at 00:12

2 Answers2

3
Control.InvalidateRect(RectF(0,0,width,height));
Lesmana
  • 25,663
  • 9
  • 82
  • 87
relativ
  • 665
  • 1
  • 7
  • 18
  • As far as I can tell, this is the correct answer to my question. The InvalidateRect() method doesn't work as I hoped it would but I guess that is due to differences between VCL and FMX. Thanks Relativ. – Shannon Matthews Dec 11 '11 at 13:24
2

FireMonkey's TControl.Repaint ends up calling TPlatformWin.ReleaseWindow. If Form.Transparency is false then this method calls the Windows InvalidateRect function, just like VCL's TControl.Invalidate does.

So Repaint actually does the same thing VCL's Invalidate does, unless Form.Transparency=true.

Giel
  • 2,066
  • 20
  • 22