Friday 15 August 2014

firemonkey - What does this Delphi code means? (From the customlistbox example) -



firemonkey - What does this Delphi code means? (From the customlistbox example) -

i looking @ examples shipped rad studio xe6 when came across custom listbox illustration located @

object pascal > firemonkey desktop > customlistbox

trying play , see modifications do, decided wanted create loop visible or not property each object. thing though can't understand next line means.

107| item.stylesdata['visible.onchange'] := tvalue.from<tnotifyevent>(dovisiblechange); // set onchange value

it adds onchange event, how exactly? tnotifyevent, how tell compiler create new event?

thanks.

the firemonkey styles framework has been designed flexible , extensible. introduced @ root of styled command hierarchy, tstyledcontrol. article gives brief introduction , explanation of philosophy behind design.

because styling framework designed back upwards many different types of controls, there clear need flexibility , extensibility. see code this:

stylesdata['visible.onchange'] := ...

the stylesdata property array property, indexed string. declared this:

property stylesdata[const index: string]: tvalue;

the tvalue type modern variant type used throughout rtl. so, gain flexibility allowing stylesdata hold kind of object, means of using variant type, tvalue. , have extensibility allowing named indices.

so, command referring allows customise behaviour when visibility changes. checking style named visible.onchange expected of type tnotifyevent. cannot supply tnotifyevent directly, have wrap in tvalue. , hence phone call tvalue<tnotifyevent>.from().

delphi firemonkey delphi-xe6

No comments:

Post a Comment