Gumps not closing completely
I am creating a gump that is a tool kit. The first gump is nothing more than a button that opens the bigger gump -- the kit. The toolkit is turned on by a command, and turned off by the same command. Here is the code:
Now when I use the command when I first log in, everythings fine. The toolkit loads, when I close it out by clicking a button or right-click, it returns to the 'button' state. When I click the button, it opens the kit again. However, when I use the command again to shut it off.. It says that the gump is still open.
Why do the Gumps still fail the check even though the command from.CloseGum(...) and from.CloseAllGumps() are used to closed the gumps?
I am creating a gump that is a tool kit. The first gump is nothing more than a button that opens the bigger gump -- the kit. The toolkit is turned on by a command, and turned off by the same command. Here is the code:
Code:
[SIZE=2]private static void ToolKit_OnCommand( CommandEventArgs e )[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2] Mobile from = e.Mobile;[/SIZE]
[SIZE=2] if( from.HasGump( typeof( GMToolKit ) ) )[/SIZE]
[SIZE=2] {[/SIZE]
[SIZE=2] from.SendMessage( "GMToolKit is open, now closing..." );[/SIZE]
[SIZE=2] from.CloseGump( typeof( GMToolKit ) );[/SIZE]
[SIZE=2] from.CloseGump( typeof( GMMiniKit ) );[/SIZE]
[SIZE=2] from.CloseAllGumps();[/SIZE]
[SIZE=2] }[/SIZE]
[SIZE=2] else[/SIZE]
[SIZE=2] {[/SIZE]
[SIZE=2] if( from.HasGump( typeof( GMMiniKit ) ) )[/SIZE]
[SIZE=2] {[/SIZE]
[SIZE=2] from.CloseAllGumps();[/SIZE]
[SIZE=2] from.SendMessage( "GMMiniKit is open, now closing..." );[/SIZE]
[SIZE=2] }[/SIZE]
[SIZE=2] else[/SIZE]
[SIZE=2] {[/SIZE]
[SIZE=2] from.CloseGump( typeof( GMToolKit ) );[/SIZE]
[SIZE=2] from.SendGump( new GMToolKit() );[/SIZE]
[SIZE=2] }[/SIZE]
[SIZE=2] }[/SIZE]
[SIZE=2]}[/SIZE]
Now when I use the command when I first log in, everythings fine. The toolkit loads, when I close it out by clicking a button or right-click, it returns to the 'button' state. When I click the button, it opens the kit again. However, when I use the command again to shut it off.. It says that the gump is still open.
Why do the Gumps still fail the check even though the command from.CloseGum(...) and from.CloseAllGumps() are used to closed the gumps?