Bug in ApplyStyleConversion?

General TRichView support forum. Please post your questions here
Post Reply
Roliat
Posts: 21
Joined: Wed Jul 27, 2011 4:12 pm

Bug in ApplyStyleConversion?

Post 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!
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Please send a sample project to reproduce this problem to richviewgmailcom (please do not include exe file)
Roliat
Posts: 21
Joined: Wed Jul 27, 2011 4:12 pm

Post 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!
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Roliat
Posts: 21
Joined: Wed Jul 27, 2011 4:12 pm

Post 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.
Post Reply