Page 1 of 1

[Demo] Plain-text checkboxes

Posted: Tue Oct 20, 2020 11:06 am
by Sergey Tkachenko
This demo shows how to implement checkboxes in TRichViewEdit using plain text.
No controls or images are used inside the editor in this demo: check marks are implemented as Unicode characters. Checkboxes are implemented as hyperlinks.
TextCheckBoxes.zip
(3.65 KiB) Downloaded 3185 times
TextCheckBoxes.png
TextCheckBoxes.png (6.76 KiB) Viewed 40475 times
This demo has methods:

Code: Select all

    // gets the checkbox value
    function GetCheckBoxValue(const CheckBoxName: String): Boolean;
    // sets the checkbox value
    procedure SetCheckBoxValue(const CheckBoxName: String; Value: Boolean);
    // occurs when a checkbox is clicked
    procedure CheckBoxClickInEditor(const CheckBoxName: String; Checked: Boolean);
It shoes how to synchronize checkboxes in the editor and a group of TCheckBox controls.

Re: [Demo] Plain-text checkboxes

Posted: Tue Oct 20, 2020 2:17 pm
by Sergey Tkachenko
This document can be stored not only in RVF but also in RTF.
Only one additional setting is needed to make checkboxes work after reloading from RTF: RichViewEdit1.RTFReadProperties.BasePathLinks = False. With this settings, hyperlink targets are saved and loaded as they are.