ToolWindow validation

Docking/MDI for Windows Forms Forum

Posted 13 years ago by Dmitry Kaganovich
Avatar
I’m trying to implement validation of my toolwindows (through “Validating” event) and even though validation fails and I set e.Cancel = true; I am still able to hide the window (if it’s docked) or navigate to a different tabbed documtent (if it’s tabbed) or click on a different floating window – it only seems to work for docked toolwindows.

I did notice that focus does stay with original toolwindow so I am unable to type anywhere else. However this becomes confusing. In the case of tabbed document windows, when validation fails, the focus remains with toolwindow1, but if user clicks on toolwindow2 and it’s brought to the front, the user can’t type in that window).

Any suggestions as to how I can work around this issue – it would be helpful to have some sort of cancelable event for before focused changed, this way if validation fails I would cancel any attempts to navigate away (will this work for floating windows?)

Thank you,

Dmitry

Comments (3)

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

We don't have anything built in extra for validation at the moment other than the native .NET features that are available.

What you said about floating windows is a valid issue. Since they are considered by Windows to be separate Forms, I doubt the .NET validation code would ever prevent you from jumping over to them. So that will definitely be bad.

The problem with validation is that a lot of the code is internal to the System assemblies so it's difficult to work around odd issues like this. As far as I know (please post if you know a way), there isn't a way to prevent focus changes other than by using the Microsoft validation code, right?


Actipro Software Support

Posted 13 years ago by Dmitry Kaganovich
Avatar
Thank you for clarifying the issue.

I don’t know of any other way of preventing focus… maybe through some Win API hooks – I know you can hook in and listen to all events that happen, not sure though whether you can cancel them or not.

Dmitry
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Yes I'm not aware of a way to cancel focus changes but if you come across anything, please let us know.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.