Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Force Ctrl+F1 to cycle between windows
Message
De
19/07/2008 12:43:44
 
 
À
17/07/2008 12:30:39
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01326709
Message ID:
01332516
Vues:
6
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform