10-10-2013
06:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
How do I go about accessing the widgetids of and/or a reference to the UI components such as the Navigation, Overview Map, etc widgets? That is, those widgets that are directly layered over the application interface and not part of a widgetcontainer. I tried using the getAllLoadedWidgetIds() method but that only returns the widgetids for the widgets that are contained within a widgetcontainer proper. I am trying to implement a Preferences widget where my users can hide/show interface components like the Navigation widget, but I can't figure out how to obtain a reference so that I can programmatically open and close the widget (or maybe set its visibility to true/false as needed). Any help that anyone could provide would be appreciated. Thanks.
Kevin
Kevin
Solved! Go to Solution.
10-11-2013
05:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
Kevin,
I have answered that one before. Find the info here:
http://forums.arcgis.com/threads/56516-Get-quot-UI-quot-Widget-by-Id-Label
Don't forget to click the Mark as answer check on this post and to click the top arrow (promote).
Follow these steps as shown in the below graphic:
I have answered that one before. Find the info here:
http://forums.arcgis.com/threads/56516-Get-quot-UI-quot-Widget-by-Id-Label
Don't forget to click the Mark as answer check on this post and to click the top arrow (promote).
Follow these steps as shown in the below graphic:
10-11-2013
09:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
Robert,
Thanks for the info. I updated the widgemanger.mxml getWidgetId function per the information in your post and get the id back now (1001) for the UI widget in question. However, using that as a reference like this has no affect:
AppEvent.dispatch(AppEvent.WIDGET_CLOSE, 1001);
Should I start another thread for that issue? Please advise. Thanks, I will mark your response as the answer given it answered the original question.
Kevin
Thanks for the info. I updated the widgemanger.mxml getWidgetId function per the information in your post and get the id back now (1001) for the UI widget in question. However, using that as a reference like this has no affect:
AppEvent.dispatch(AppEvent.WIDGET_CLOSE, 1001);
Should I start another thread for that issue? Please advise. Thanks, I will mark your response as the answer given it answered the original question.
Kevin
10-11-2013
09:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
Kevin,
The answer to that question can be found here:
http://forums.arcgis.com/threads/57718-Remove-a-UI-element
The answer to that question can be found here:
http://forums.arcgis.com/threads/57718-Remove-a-UI-element
10-11-2013
06:56 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
Robert,
Thank you very much for the additional info. I followed the steps in your post and this works for getting the widget closed, but how about reopening it? I tried the code below and it did not work. I also tried dispatching a widget_add event and a widget_change_state event and neither of them worked either. Basically, in my Preferences widget I want to be able to let my users click a checkbox to hide/show the Navigation widget. Any additional help that you might be able to provide would be appreciated. Thanks.
Kevin
var oId:Number = ViewerContainer.getInstance().widgetManager.getWidgetId("Navigation",true);
var openWidget:Object = {
id: oId,
state: WidgetStates.WIDGET_OPENED
}
AppEvent.dispatch(AppEvent.WIDGET_STATE_CHANGED, openWidget);
Thank you very much for the additional info. I followed the steps in your post and this works for getting the widget closed, but how about reopening it? I tried the code below and it did not work. I also tried dispatching a widget_add event and a widget_change_state event and neither of them worked either. Basically, in my Preferences widget I want to be able to let my users click a checkbox to hide/show the Navigation widget. Any additional help that you might be able to provide would be appreciated. Thanks.
Kevin
var oId:Number = ViewerContainer.getInstance().widgetManager.getWidgetId("Navigation",true);
var openWidget:Object = {
id: oId,
state: WidgetStates.WIDGET_OPENED
}
AppEvent.dispatch(AppEvent.WIDGET_STATE_CHANGED, openWidget);
10-15-2013
04:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
Kevin,
To open a widget you would use this line.
To open a widget you would use this line.
AppEvent.dispatch(AppEvent.WIDGET_RUN, yourWidgetsID#);
10-19-2013
01:27 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
Robert,
Thanks for the additional information. I have been playing with this and still cannot get it to work. The code below works fine for the closing of the widget, but the opening still does not work even when I dispatch the WIDGET_RUN event. Do you have any other suggestions? Any additional help that you might be able to provide would be appreciated. Thanks.
Kevin
// Checkbox definition:
<mx:CheckBox id="showZoomSlider" selected="true" click="showZoomSlider_clickHandler(event)" />
// Checkbox event handler:
protected function showZoomSlider_clickHandler(event:MouseEvent):void
{
if( showZoomSlider.selected )
{
var oId:Number = ViewerContainer.getInstance().widgetManager.getWidgetId("Navigation",true);
AppEvent.dispatch(AppEvent.WIDGET_RUN, oId);
Alert.show( oId.toString()); //Shows the widgetid of 1000
}
else
{
var cId:Number = ViewerContainer.getInstance().widgetManager.getWidgetId("Navigation",true);
var data:Object = {
id: cId,
state: WidgetStates.WIDGET_CLOSED}
AppEvent.dispatch(AppEvent.WIDGET_STATE_CHANGED, data);
}
}
Thanks for the additional information. I have been playing with this and still cannot get it to work. The code below works fine for the closing of the widget, but the opening still does not work even when I dispatch the WIDGET_RUN event. Do you have any other suggestions? Any additional help that you might be able to provide would be appreciated. Thanks.
Kevin
// Checkbox definition:
<mx:CheckBox id="showZoomSlider" selected="true" click="showZoomSlider_clickHandler(event)" />
// Checkbox event handler:
protected function showZoomSlider_clickHandler(event:MouseEvent):void
{
if( showZoomSlider.selected )
{
var oId:Number = ViewerContainer.getInstance().widgetManager.getWidgetId("Navigation",true);
AppEvent.dispatch(AppEvent.WIDGET_RUN, oId);
Alert.show( oId.toString()); //Shows the widgetid of 1000
}
else
{
var cId:Number = ViewerContainer.getInstance().widgetManager.getWidgetId("Navigation",true);
var data:Object = {
id: cId,
state: WidgetStates.WIDGET_CLOSED}
AppEvent.dispatch(AppEvent.WIDGET_STATE_CHANGED, data);
}
}
10-20-2013
05:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
Kevin,
I don't know if I have evene tried to open a UI widget programatically, but I would assume that is is not supported in the OTB WidgetManager as this is the reason you are unsucessfull. If I find some time to chase that rabbit I will post back.
I don't know if I have evene tried to open a UI widget programatically, but I would assume that is is not supported in the OTB WidgetManager as this is the reason you are unsucessfull. If I find some time to chase that rabbit I will post back.