4
votes
Vote UpVote

Don’t expect the Parent property to be set inside an FMX control’s Paint method

Delphi Haven – So… I’m working on a little custom FireMonkey control. As in the VCL, if you want to handle drawing a custom control yourself, you need to override its Paint method. In my case the override was looking like this: procedure TMyChildControl.Paint; begin if (Parent <> nil) and (Parent.Parent is TMyOtherControl) then Canvas.Font.Assign(TMyOtherControl(Parent.Parent).Font); Canvas.FillText(LocalRect, SomeText, False, 1, [], TTextAlign.taCenter); end; If you’re wondering, this was partly a workaround for the fact FMX doesn’t have a ‘parent font’ ...
Favorite? Off-Topic? Chris Rolliston @ 2013-07-05 19:00

Statistics

Visits: 612
Votes: 4
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Alister Christie
Peter
Ravaut123
vintagedave
Subscribe:
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News

Sponsor

 
Please login or register to use this functionality.
(click on this box to dismiss)