How to disabled Command in .NET??

428
1
08-19-2010 12:10 AM
martinmaretta
Occasional Contributor
hi i create base map command in .NET, but command is still enabled? How can I disabled it when PageLayout is active and enable it when MapView is active? ...thaks a lot.. Martin
0 Kudos
1 Reply
AndrewMay
New Contributor
I assume you mean you've created a class implementing the ICommand interface.  If so, you need to put your enable/disable logic in the ICommand::Enabled method.  Return true to enable the command and false to disable it.  You'll need something like the following:

Dim pActiveView as IActiveView
pActiveView = pMxDoc.ActiveView
If Typeof pActiveView Is IMap Then
' Map object
return true
Else
' PageLayout object
return false
End If
0 Kudos