Greetings,
I have a lot of select then work with text in a big function and I would like to disable the updating of all the Font Combos, sizes etc. that are through RVAControlPanel.
I've tried ActionsEnabled := False before the function then ActionsEnabled := True after the function.
But it does not seem to do what I need. I still see the interface updating. Ideas.... ???
Disabling Actions during a function then restoring.
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Disabling Actions during a function then restoring.
But assigning RVAControlPanel.ActionsEnabled = False really disables all RichViewActions.
However, if you call the function like this:
you will not see that buttons are disabled for a second. It's because actions were not be able to update their states.
We can do it manually:
Still no effect. It's because, while actions were updated, toolbars were not repainted.
So we repainting them:
This code works. But not If this code is not called from a toolbar's button OnClick.
It works for all toolbars but not for a toolbar that contains a button that executes this code.
The problem can be solved by using PostMessage. Let me know if you need explanation how to do it.
However, if you call the function like this:
Code: Select all
RVAControlPanel1.ActionsEnabled := False;
Sleep(1000);
RVAControlPanel1.ActionsEnabled := True;
We can do it manually:
Code: Select all
RVAControlPanel1.ActionsEnabled := False;
for i := 0 to ActionList1.ActionCount - 1 do
ActionList1.Actions[i].Update;
Sleep(1000);
RVAControlPanel1.ActionsEnabled := True;
So we repainting them:
Code: Select all
RVAControlPanel1.ActionsEnabled := False;
for i := 0 to ActionList1.ActionCount - 1 do
ActionList1.Actions[i].Update;
ToolBar1.Repaint;
ToolBar2.Repaint;
ToolBar3.Repaint;
Sleep(1000);
RVAControlPanel1.ActionsEnabled := True;
It works for all toolbars but not for a toolbar that contains a button that executes this code.
The problem can be solved by using PostMessage. Let me know if you need explanation how to do it.
Re: Disabling Actions during a function then restoring.
Greetings Sergey,
Excellent thank you.
Do you have any recommendations to help speed up specifically GetSelection and SetSelection below.
>Select All Text
>Find a matching format Using GetSelection, SetSelection
>>>Once I have a selection of items I check the format of the items this goes quite fast
>Work with regex of this text
When I do SetSelection all icons are updated, font combo etc. I am not sure if this is slowing things down. Thus my previous question.
Is there a way to have a TRichViewEdit SetSelection only select items and do nothing else no icon update, no showing of what is select just the bare minimum for speed. Or should I use something else than SetSelection (I need to work with items and offs) is there something in RVData that would be better?
Excellent thank you.
Do you have any recommendations to help speed up specifically GetSelection and SetSelection below.
>Select All Text
>Find a matching format Using GetSelection, SetSelection
>>>Once I have a selection of items I check the format of the items this goes quite fast
>Work with regex of this text
When I do SetSelection all icons are updated, font combo etc. I am not sure if this is slowing things down. Thus my previous question.
Is there a way to have a TRichViewEdit SetSelection only select items and do nothing else no icon update, no showing of what is select just the bare minimum for speed. Or should I use something else than SetSelection (I need to work with items and offs) is there something in RVData that would be better?
Re: Disabling Actions during a function then restoring.
Nevermind Sergey,
It was a problem with recopying over and over a large String. (I found my problem)
It was a problem with recopying over and over a large String. (I found my problem)
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Disabling Actions during a function then restoring.
Just a note: ActionsEnabled disables all actions, but not font combo boxes. You need to assign Enabled properties of these combo boxes manually.