TRichViewEdit, Actions and ExpressBars

General TRichView support forum. Please post your questions here
Post Reply
mphilbrick
Posts: 27
Joined: Mon Aug 29, 2005 7:08 pm

TRichViewEdit, Actions and ExpressBars

Post by mphilbrick »

Sergey,

I am replacing the standard toolbars in the RichView Actions demo with ExpressBars from DevExpress.

I assigned actions to all of the toolbar buttons and they are working. However, the buttons do not reflect the editor state. For example, when the Bold button is clicked, it does not stay depressed, and I cannot remove bold. All controls are enabled, even when some do not apply.

Also, I have this compiled as an ActiveX "application" and I used the code from a 2004 posting about DLL's to make sure my actions execute correctly. To make things more complex, my "editor" (toolbars and TRichViewEdit) is in a frame so I can place it in multiple forms.

Actions are still a mystery to me and I do not understand how they allow interaction between the controls and the editor so that the current state is reflected.

What am I missing?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I am not sure how DevExpress buttons work, but probably some button's property must be set to allow it be checked (stay pressed)
mphilbrick
Posts: 27
Joined: Mon Aug 29, 2005 7:08 pm

Post by mphilbrick »

Sergey,

Thanks. I figured it out. I did not understand how actions were able to update the connected controls. The issue was the same as a 2004 post about no automatic updates in DLL's.

The code you posted did not work:

Re: TDBRichViewEdit in the DLL
Date: Sat, 4 Sep 2004 19:05:44 +0400

procedure TMyForm.Timer1Timer(Sender: TObject);
var i: Integer;
begin
for i := 0 to ComponentCount-1 do
if Components is TrvAction then
TrvAction(Components).UpdateTarget(RichViewEdit1);
end;

The problem is that no component is evaluated as a TrvAction. I modified the code as follows and it did work:

procedure TfrMacroEditor.tmActionUpdateTimer(Sender: TObject);
var
x : integer;
begin
with dmRichViewMod.alEditor do
for x := 0 to ActionCount - 1 do
if Actions[x] is TrvAction then
Actions[x].UpdateTarget(rvMacro);
end;
Post Reply