Color controls & custom color set

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #33596
    prefont
    Participant

    What is your advice for keeping a common “custom color set” for all color components in an app?

    I notice TsColorSelect has “ColorDialog : TColorDialog” but this is never assigned, so it just creates and uses a local “cd : TColorDialog” each time, so the custom colors are not saved between clicks.

    TsCustomColorBox has a global “ColDlg : TColorDialog” that it uses, so the custom colors are saved.

    What I have come up with so far is this:

    (in form create)
    ColDlg := TsColorDialog.create(nil);
    sColorselect1.ColorDialog := ColDlg;
    sColorselect2.ColorDialog := ColDlg;

    The save and restore them using ColDlg.Customcolors.

    Does this seem about right to you?

    #41895
    Support
    Keymaster

    Hello
    Yes, you can define this global variable and this dialog will be used for a color choosing.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.