Click here to Skip to main content
15,904,416 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all.

I am designing a software that uses a simple text editor, based on scintilla.
The software has a tool bar, where the buttons' state are defined by external scintilla's flags. I've achieved this inside the WinMain's message loop, calling the handler function that checks the flags and updates the tool bar.

My questions are:
Is this the best way to handle the buttons state update? (hoping that is not...)
Does it adds great overhead to the program?

Thanks!

Paulo Sherring.
Posted
Updated 28-Oct-11 9:18am
v2

1 solution

Normally, in the case of text editor, this is done on every state update of the text buffers, including creation a new one, closing, changing focused tab, etc., In other words — states of any documents. No it is not. :-)

(I mean, you can do it in a more fine-grain manner, but you can hardly win any noticeable performance. Where a single user input is involved, one millisecond or few does not count. Better put all updates in one single call like UpdateControlStates and call in from all the highest-level event handlers of the event which can potentially update a document state. This will ensure your code is kept simple and you have a less chance of a bug.)

—SA
 
Share this answer
 
Comments
Espen Harlinn 29-Oct-11 13:37pm    
Good points :)
Sergey Alexandrovich Kryukov 29-Oct-11 21:27pm    
Thank you, Espen,
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900