I try to set up "smart popups" and run into a strange behaviour. I've button, that makes the selected Text bold (same code as from your demo). This button makes the selected text bold indeed.
BUT: I've a second button (that one from the smart popup). Its onClick has the following code:
But nothing happens. OnStyleConversion is being called and the UserData is passed correctly. When I press the "original" bold-button, the same code works.
If you want, I can do so. But this behaviour can be reached also with your demo (Editor 2). Just add an label on the form and type this code in the OnClick-action
procedure TForm1.Label1Click(Sender: TObject);
begin
rve.ApplyStyleConversion(TEXT_BOLD);
end;
This code has absolutely no effect on the text. If I click the Bold-Button (with Tag "1" / 1 = TEXT_BOLD) everything works fine. Why can't I call the ApplyStyleConversion(USERDATA) from the place I wanted to?
Oh, I understand. This demo stores the current state of bold/italic/underline in the states of corresponding buttons (btnBold.Down, etc.) See rveCurTextStyleChanged procedure.
In rveStyleConversion, the state of buttons is checked and text is made bold/normal depending on btnBold.Down, etc.
If you call ApplyStyleConversion not from the button's OnClick, call btnBold.Down := not btnBold.Down before ApplyStyleConversion.