开发者

How do I get the DropDown selection from a Command Button in ArcObjects?

I have a dropdo开发者_StackOverflow中文版wn and a Icommand button in the same toolbar in ArcMap. I can't seem to get access to the dropdowns selection when I am using the command button.

How can I find the dropdown so I can find out what the user just selected?

Thanks

Scott


If your dropdown is within a command that implements IToolControl, you should be able to use ICommandbars.Find to find the command, then cast it to MyToolControl, then use MyToolControl.Selection. Selection is a method you'll need to implement that accesses the contained dropdown.

Another (more MVC-ish) way is to have the IToolControl update a property on a custom IExtension (e.g. MyExtension.MyProperty), which is implemented to raise an event when the property has changed so that other tools can be in synch.


I found the Drop Down with this code... Then I dove a little Deeper to pull the dropdown out.

var commandBars= m_application.Document.CommandBars;
           ESRI.ArcGIS.esriSystem.UID pUID = new UIDClass();
           pUID.Value = "{A6D2046E-F92C-440f-B54B-91899B4F667E}";
           var commmandItem = commandBars.Find(pUID, false, false);

Then the Dropdown was at:

(ComboBox)((LOSBaseCampExample.LOSSurroundBaseCampControl)(commmandItem.Command)).Controls[0])

Note: LOSBaseCampExample.LOSSurroundBaseCampControl was the name of MY tool... Your will be different.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜