Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Security Menus and Forms
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
00940989
Message ID:
00941238
Views:
21
Shawn,

>The Problem
>
>I get two options forms.

I'm able to duplicate this...it only seems to happen the second (and subsequent) times you launch the Security Setup Form.

It looks like the behavior of Windows Forms changed since I originally wrote the code for mmMenuExtender (from .NET Version 1.0 to Version 1.1). The heroics I had to go through to launch the form (after closing the Security Setup dialog) are no longer necessary. I've fixed this for the next version, but if you want to get this behavior now, you can create a subclass of mmMenuExtender and override the OnClick() method...

In C#:
protected override void OnClick(object sender, System.EventArgs e)
{
	MenuItem menuItem = (MenuItem)sender;

	if (mmAppDesktop.SecuritySetupMode)
	{
		// Get the control ID for this menu item
		Guid ControlID = this.GetControlID(menuItem);

		if (ControlID != Guid.Empty)
		{
			// Set as the current menu item
			this.CurrentMenuItem = menuItem;
			this.ControlID = ControlID;

			// Display the cursor as an hourglass
			Cursor.Current = Cursors.WaitCursor;

			// Launch the User Security Setup form
			mmFactoryDesktop factory = (mmFactoryDesktop)mmAppDesktop.Factory;
			mmSecuritySetupForm form = factory.CreateSecuritySetupForm(this);
			form.ShowDialog();

			// Clear as the current menu item
			this.CurrentMenuItem = null;
		}
	}
}
And in VB .NET:
Protected Overrides Sub OnClick(sender As Object, e As System.EventArgs)
   Dim menuItem As MenuItem = CType(sender, MenuItem)
   
   If mmAppDesktop.SecuritySetupMode Then
      ' Get the control ID for this menu item
      Dim ControlID As Guid = Me.GetControlID(menuItem)
      
      If ControlID <> Guid.Empty Then
         ' Set as the current menu item
         Me.CurrentMenuItem = menuItem
         Me.ControlID = ControlID
         
         ' Display the cursor as an hourglass
         Cursor.Current = Cursors.WaitCursor
         
         ' Launch the User Security Setup form
         Dim factory As mmFactoryDesktop = CType(mmAppDesktop.Factory, mmFactoryDesktop)
         Dim form As mmSecuritySetupForm = factory.CreateSecuritySetupForm(Me)
         form.ShowDialog()
         
         ' Clear as the current menu item
         Me.CurrentMenuItem = Nothing
      End If
   End If
End Sub
Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Previous
Reply
Map
View

Click here to load this message in the networking platform