Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Puzzling cbEVT_EDITOR_* event behavior
dmoore:
Stuff I learned while playing with EditorTweaks...
When an editor is opened, C::B generates cbEVT_EDITOR_DEACTIVATED if already open editor, then cbEVT_EDITOR_ACTIVATED then cbEVT_EDITOR_OPEN
switching between editors: cbEVT_EDITOR_DEACTIVATED then cbEVT_EDITOR_ACTIVATED
When an editor is closed cbEVT_EDITOR_ACTIVATED for any new editor then cbEVT_EDITOR_CLOSED, but no cbEVT_EDITOR_DEACTIVATED!
Is this right? (disclaimer: the C::B on this box is a few of months out of date -- I'll test again on an up to date copy)
In particular,
1/ why no cbEVT_EDITOR_DEACTIVATED on close?
2/ why activated before open/close?
A slightly related issue. Might it be good to send some sort of notification after changing editor/environment settings?
MortenMacFly:
--- Quote from: dmoore on December 10, 2009, 06:04:35 am ---When an editor is opened, C::B generates cbEVT_EDITOR_DEACTIVATED if already open editor, then cbEVT_EDITOR_ACTIVATED then cbEVT_EDITOR_OPEN
--- End quote ---
Yes, Deactivated means "editor still open, but another one got active".
--- Quote from: dmoore on December 10, 2009, 06:04:35 am ---switching between editors: cbEVT_EDITOR_DEACTIVATED then cbEVT_EDITOR_ACTIVATED
--- End quote ---
Logical here, too.
--- Quote from: dmoore on December 10, 2009, 06:04:35 am ---When an editor is closed cbEVT_EDITOR_ACTIVATED for any new editor then cbEVT_EDITOR_CLOSED, but no cbEVT_EDITOR_DEACTIVATED!
--- End quote ---
Correct here, too as the editor closed is not "de-activated" (meaning still accessible), but truly destroyed.
dmoore:
--- Quote from: MortenMacFly on December 10, 2009, 06:44:32 am ---
--- Quote from: dmoore on December 10, 2009, 06:04:35 am ---When an editor is opened, C::B generates cbEVT_EDITOR_DEACTIVATED if already open editor, then cbEVT_EDITOR_ACTIVATED then cbEVT_EDITOR_OPEN
--- End quote ---
Yes, Deactivated means "editor still open, but another one got active".
--- End quote ---
I was expecting: cbEVT_EDITOR_DEACTIVATED if already open editor, cbEVT_EDITOR_OPEN then cbEVT_EDITOR_ACTIVATED
--- Quote ---
--- Quote from: dmoore on December 10, 2009, 06:04:35 am ---When an editor is closed cbEVT_EDITOR_ACTIVATED for any new editor then cbEVT_EDITOR_CLOSED, but no cbEVT_EDITOR_DEACTIVATED!
--- End quote ---
Correct here, too as the editor closed is not "de-activated" (meaning still accessible), but truly destroyed.
--- End quote ---
I expected: cbEVT_EDITOR_DEACTIVATED, cbEVT_EDITOR_CLOSED then cbEVT_EDITOR_ACTIVATED
You might be "legally"/"factually" right about these things, but this isn't very convenient behavior for a plugin developer. e.g. plugin wants to change menus depending on which editor is active, deactivating items if the editor closes. I would expect to only have to trap [DE]ACTIVATED events. Instead we have to trap the CLOSE event as well and to make it more difficult the CLOSE event comes after the ACTIVATE event, which requires a check to see if there is anything still open after the close (instead of just relying on the ACTIVATE event). You can work around it, but it takes extra work and is VERY confusing.
Maybe I just don't see the problem the current behavior solves.
ollydbg:
--- Quote from: dmoore on December 10, 2009, 01:58:29 pm ---
--- Quote from: MortenMacFly on December 10, 2009, 06:44:32 am ---
--- Quote from: dmoore on December 10, 2009, 06:04:35 am ---When an editor is opened, C::B generates cbEVT_EDITOR_DEACTIVATED if already open editor, then cbEVT_EDITOR_ACTIVATED then cbEVT_EDITOR_OPEN
--- End quote ---
Yes, Deactivated means "editor still open, but another one got active".
--- End quote ---
I was expecting: cbEVT_EDITOR_DEACTIVATED if already open editor, cbEVT_EDITOR_OPEN then cbEVT_EDITOR_ACTIVATED
--- End quote ---
example 1 , we have three files, A, B and C.
Now, A is already opened and the only active editor. B and C are not opened, so there is only one tab.
Action: If B is opened and activated, I expect the command sequence is:
cbEVT_EDITOR_DEACTIVATED of A
cbEVT_EDITOR_OPEN of B
cbEVT_EDITOR_ACTIVATED of B
example 2 , we have three files, A, B and C.
Now, A and B is already opened and A is the active editor. C are not opened.
Action: If B is activated, I expect the command sequence is:
cbEVT_EDITOR_DEACTIVATED of A
cbEVT_EDITOR_ACTIVATED of B
Am I right??
dmoore:
--- Quote from: ollydbg on December 10, 2009, 02:25:39 pm ---example 1 , we have three files, A, B and C.
Now, A is already opened and the only active editor. B and C are not opened, so there is only one tab.
Action: If B is opened and activated, I expect the command sequence is:
cbEVT_EDITOR_DEACTIVATED of A
cbEVT_EDITOR_OPEN of B
cbEVT_EDITOR_ACTIVATED of B
--- End quote ---
not quite: cbEVT_EDITOR_DEACTIVATED of A, cbEVT_EDITOR_ACTIVATED of B then cbEVT_EDITOR_OPEN of B
so cbEVT_EDITOR_OPEN really means open and fully loaded?
--- Quote ---Action: If B is activated, I expect the command sequence is:
cbEVT_EDITOR_DEACTIVATED of A
cbEVT_EDITOR_ACTIVATED of B
Am I right??
--- End quote ---
yes.
Navigation
[0] Message Index
[#] Next page
Go to full version