Not losing focus correctly (sanity check)

SyntaxEditor for Windows Forms Forum

Posted 13 years ago by Justin Stenning - Manager, Research & Development, netcat.biz Pty Ltd
Version: 4.0.0232
Avatar
Hi All,

I'm currently experiencing a strange problem where the SyntaxEditor appears to not be losing focus when i switch to another window/application using the windows taskbar

(this doesn't happen every single time, but very frequent - i.e. every 3rd or 4th time - the problem doesn't occur if i alt+tab to the other app or click its window directly to switch).

This causes an issue in that the .Activated event of my form will not trigger when i come back, and i have some code relying on that.

Can anyone confirm a similar behaviour? Or have any suggestions?

(by retaining focus i mean the current line highlight stays visible and the caret continues to blink, whereas when you click on another application without using the taskbar these correctly hide and the selected text dims)

Cheers,
J

Comments (3)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Justin,

Hmm... I did some testing and see the same behavior. Wow this is a frustrating one... been working the last couple hours on it. It seems that stopping and restarting the caret timer is somehow preventing the Form.Deactivate event from firing.

Actually in the scenario you outlined, Form.Deactivate does fire once, Form.Activate fires again (unknown reason but it happens on other forms without SyntaxEditor controls too), and normally Form.Deactivate fires a second time but in this case, the stopping of the caret blink timer is preventing that from happening.

If I comment out the code that stops the timer when the control loses focus, everything works as expected. But obviously this isn't a good thing to do if you have multiple SyntaxEditor controls in use since all of them would constantly have a timer running.

I did find a workaround for the bug. If I let the timer go one more cycle upon LostFocus before turning it off, by that time the Deactivate event has fired again and everything seems to work correctly.

[Modified at 11/01/2006 09:07 AM]


Actipro Software Support

Posted 13 years ago by Justin Stenning - Manager, Research & Development, netcat.biz Pty Ltd
Avatar
Thanks for that, I'm glad you were able to reproduce the same behaviour.

The workaround obviously won't be available until the next maintenance release, do you have any idea on the ETA of that? I realise that there has just been one so it might be some time away.

Thanks again,

Justin
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Probably fairly soon... we have several updates in place already for the next maintenance release.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 6 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.