How to disable TAdvRichEditorFormatToolbar if TAdvRichEditor is read only


I'm testing TAdvRichEditorFormatToolBar with TAdvRichEditor in my project. It's great that the toolbar "reacts" to the caret position and mark the bold button when I click a bold word and all those things when I'm editing a document.

But when I only want to view it with no possible modification (ReadOnly property to true) it's weird that the toolbar keeps behaving the same and can be confusing for the user. I've tried to disable it (Enable to false) and even assign a NULL pointer to its RichEditor property but no luck. The toolbar behaves like i were in a editor mode.

Is there any way to split / disconnect it from the TAdvRichEditor to leave it as "dead" if I'm in a "only view" mode?


I have rechecked this here and when TAdvRichEditorFormatToolBar.Enabled = false, I cannot see a possible interaction with the TAdvRichEditor when clicking it. All controls on the TAdvRichEditorFormatToolBar are disabled. So, not sure what different behavior you want from that?

Thanks Bruno for the reply.

Effectively, all the buttons are disabled if I set Enabled to false in the toolbar but the push down buttons like bold, italic, align left, center, etc, ... are still updating its state (pushed or no pushed) when I click over the TAdvRichEditor text / words. That behavior can lead my customers to think that they can change the text format and they can't because the TAdvRichEditor is read only.

Maybe you can set AdvRichEditorToolBar.RichEditor := nil while you set AdvRichEditor.ReadOnly = true if you do not want to see the button state reflect the style of selected text.

I have done it and didin't solve the issue as I stated in my first message.

In fact, I have done some more testings and if toolbar is Enabled = true and RichEdit = NULL it is still updating (ex. If I click over a bullet list, bullet button is pushed down, if I click over a bold word, the bold button is pushed down and so on).

It seems that the toolbar is still linked someway with my TAdvRichEditor even if its RichEditor property is assigned to NULL.

Any tip that can help me?


We investigated deeper and each control on the toolbar is linked to the TAdvRichEditor via an action. The action on the control keeps working regardless of the toolbar.
There is as such not an easy solution for this other than looping through the toolbar controls and disable these actions per control.

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.