MDI Form DeActivating event

Welcome to Wisej Support.
Questions, suggestions and plain old bugs - are all welcome here!
0
0

Hi guys,

The TabControl has a Deselecting event with TabControlCancelEventArgs, where e.Cancel can be set to true to cancel the action. Can we have the same for the MDI Parent Form? Or in the (MDI Child) Form, in the DeActivate event have EventArgs with a Cancel action? Unless there is another way to stop switching between MDI children which I don’t know.

Best,
Alex

 

  • You must to post comments
0
0

Hi Alex,

Menu merging is controlled by 2 properties: MergeOrder and MergeType.

Find a basic sample here and see how/where menus are added.

Best regards
Frank

  • You must to post comments
0
0

Hi Frank,

It works, thanks!

Since we are talking about MDI, can you elaborate on the following point of your new beta version? To be honest I don’t quite understand what you mean. An example would be very helpful:

“Mdi child forms merge their menu into the parent’s menu when activated.”

Best,
Alex

 

  • You must to post comments
0
0

Hi Alex,

can you please retest with build 1.2.82 ?

Thanks in advance,
Frank

  • You must to post comments
0
0

Ok, Luca, no worries, I’ll wait for the next build, or may be the release!

Best,
Alex

  • You must to post comments
0
0

Hi Alex,

I can’t reproduce with my build, so hopefully it was fixed by something else. There has been a lot of work with  the mdi system to close the release,  including merging the mdi child menu with the parent’s menu, moving the preview icon  out of the tabs bar so it’s in a fixed location – which required a rewrite of the tabbed mdi child system.

Best,

Luca

  • You must to post comments
0
0

Hi Luca,

I knew about the e.Cancel in the OnFormClosing, that’s why I was expecting the same in OnDeActivate. I hadn’t thought about calling the Activate method in the OnDeActivate event.

However, when I did it, I got stacked in a stackoverflow. It looks like the activation in the deactivate event keeps firing in a loop. Unless I haven’t understood your comment above “In the activation/deactivation process Wisej checked whether the deactivated form has reactivated itself” and I should be doing something myself.

I have attached a simple project which shows the problem. Go to the second MDI tab: with the textbox empty, you can freely switch tabs. If you enter “1” in the textbox and try to switch, the operation is caught in the deactivate/activate chain and the stackoverflow occurs.

Best,
Alex

  • You must to post comments
0
0

Hi Alex,

You can prevent a form (including mdi children) from getting deactivated by calling Activate() in OnDeactivate(). In the activation/deactivation process Wisej checked whether the deactivated form has reactivated itself.

You can also prevent a form (including mdi children) from getting closed by setting e.Cancel=true in OnFormClosing().

Best,

Luca

 

  • You must to post comments
Showing 7 results
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Attachment
File Name Size
There are currently no files uploaded.
Maximum number of files 5, maximum file size 3.9MB.
Supported file formats: zip pdf gif jpg bmp png cs vb theme json