Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Force Ctrl+F1 to cycle between windows
Message
From
19/07/2008 12:43:44
 
 
To
17/07/2008 12:30:39
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01326709
Message ID:
01332516
Views:
7
>I found that this code works in MDI child:
>
>                case Keys.Control | Keys.F1:
>                    for (int i = 0; i < FormManager.MainForm.MdiChildren.Length; i++)
>                    {
>                        if (FormManager.MainForm.MdiChildren[i] == this)
>                        {
>
>                            if (i < FormManager.MainForm.MdiChildren.Length - 1)
>                                FormManager.MainForm.MdiChildren[i + 1].Focus();
>                            else
>                                FormManager.MainForm.MdiChildren[0].Focus();
>
>                            return true;
>                        }
>                    }
>                    return true;
>
>It this same as your code?


No, I already showed you my code and this is not the same. My code goes in the Mdi Parent, not the Child and I believe that is where it belongs. A parent should know about and control it's children. The children should not need to know about nor control any other children. The child should only know and care about it's parent.

>Using ProcessCmdKey forces application to run with unmanaged code rights:
>
>[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
>
>How to implement Ctrl+F1 so that application works without UnmanagedCode right ?


I don't know where you got that idea. I think one of us is mis-reading the documentation (and it could very well be me <g>). I use the ProcessCmdKey without those security attributes and AFAIK, it works just fine. If I understand the SecurityPermissionAttribute correctly, that is just for *requesting* those permissions. It's not *necessary* to request them to use the ProcessCmdKey.

If I'm wrong (which is entirely possible), could you or someone point me to a resource that explains this better?

~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform