delphifiremonkeylivebindings

Delphi FMX LiveBindings Rectangle.Fill.Color from a Database Field


I need to assign a TRectangle.Fill.Color from a database field using LiveBindings, it looks like a simple thing, but I could not do it. Maybe the field type, maybe the value, but when assigned from a PrototypedBinding...it works.

How can I assign a color using livebindings?

Thank you in advanced!


Solution

  • Here is a working example of what you need:

    The field type is LongWord because System.UITypes declares TAlphaColor = type Cardinal and both Cardinal and LongWord are aliases for UInt32.

    Watch the values generated by PrototypeBindSource (on the right): enter image description here

    Check if the values from your database correspond to the unsigned integer values representing the required colors. Maybe you tried too small values?

    And here is a pattern of bindings for the given form: enter image description here