Page 1 of 1

Bug in ApplyStyleConversion?

Posted: Fri Jul 29, 2011 4:24 pm
by Roliat
Hey!

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:

Code: Select all

  rve.ApplyStyleConversion(TEXT_BOLD)
But nothing happens. OnStyleConversion is being called and the UserData is passed correctly. When I press the "original" bold-button, the same code works.

What's wrong?

Thanks!

Posted: Sat Jul 30, 2011 9:30 am
by Sergey Tkachenko
Please send a sample project to reproduce this problem to richviewgmailcom (please do not include exe file)

Posted: Sat Jul 30, 2011 10:18 am
by Roliat
Hi. Thanks for your answer.

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

Code: Select all

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?

However, shall I send you a demo file?

Thanks!

Posted: Sun Jul 31, 2011 8:39 am
by Sergey Tkachenko
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.

Posted: Mon Aug 01, 2011 8:57 am
by Roliat
Oh sorry. I haven't read the code carefully enough. It was a dumb question. Now everything is working fine! Shame on me ;)

Thank you.