<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic open a widget with keyboard shortcut in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/open-a-widget-with-keyboard-shortcut/m-p/578674#M13049</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am just starting out with flex using the ArcGIS Viewer for Flex and was wondering how to open a widget (ex. Bookmarks) with a keyboard event.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Mar 2011 14:29:33 GMT</pubDate>
    <dc:creator>RobertAndren</dc:creator>
    <dc:date>2011-03-23T14:29:33Z</dc:date>
    <item>
      <title>open a widget with keyboard shortcut</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/open-a-widget-with-keyboard-shortcut/m-p/578674#M13049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am just starting out with flex using the ArcGIS Viewer for Flex and was wondering how to open a widget (ex. Bookmarks) with a keyboard event.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Mar 2011 14:29:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/open-a-widget-with-keyboard-shortcut/m-p/578674#M13049</guid>
      <dc:creator>RobertAndren</dc:creator>
      <dc:date>2011-03-23T14:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: open a widget with keyboard shortcut</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/open-a-widget-with-keyboard-shortcut/m-p/578675#M13050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Good idea.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would register a keyboard event and then have a listener that looksa for a particular character code and dispatches an appEvent to openWidget when the character matches the shortcut. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could add the keyboard event listener to the widget manager.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Mar 2011 16:12:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/open-a-widget-with-keyboard-shortcut/m-p/578675#M13050</guid>
      <dc:creator>JohnGarvey</dc:creator>
      <dc:date>2011-03-23T16:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: open a widget with keyboard shortcut</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/open-a-widget-with-keyboard-shortcut/m-p/578676#M13051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Actually I think you would have to have the KeyboardEvent listener added to the stage in the main application (i.e. index.mxml).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Something like this added to the index.mxml on application complete event:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;stage.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown);&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and then use a dispatch event like this to launch the widget:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;ViewerContainer.dispatchEvent(new AppEvent(AppEvent.WIDGET_RUN, id));&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Where id is the number of the widget (each widget as it is loaded is given a sequential number starting at 0).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Mar 2011 16:39:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/open-a-widget-with-keyboard-shortcut/m-p/578676#M13051</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2011-03-23T16:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: open a widget with keyboard shortcut</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/open-a-widget-with-keyboard-shortcut/m-p/578677#M13052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I added the KeyboardEvent listener to the stage in the main application like Robert suggested but the user has to click inside the map before the keyboard shortcut works.&amp;nbsp; Would it be possible enable the shortcut without first clicking in the map?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Mar 2011 18:42:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/open-a-widget-with-keyboard-shortcut/m-p/578677#M13052</guid>
      <dc:creator>RobertAndren</dc:creator>
      <dc:date>2011-03-23T18:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: open a widget with keyboard shortcut</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/open-a-widget-with-keyboard-shortcut/m-p/578678#M13053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Robert,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; The Flex Viewer application does not have focus when the app is launched so you have to add some code in the index.mxml to force it to have focus immediately.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Add this script block to the index.mxml:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;lt;fx:Script&amp;gt;
&amp;nbsp; &amp;lt;![CDATA[&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; protected function init():void
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; navigateToURL(new URLRequest("javascript: document.getElementById('index').focus();"), "_self");
&amp;nbsp;&amp;nbsp; }
&amp;nbsp; ]]&amp;gt;
 &amp;lt;/fx:Script&amp;gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:52:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/open-a-widget-with-keyboard-shortcut/m-p/578678#M13053</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T00:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: open a widget with keyboard shortcut</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/open-a-widget-with-keyboard-shortcut/m-p/578679#M13054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That did the trick.&amp;nbsp; Thanks for all your help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Mar 2011 12:56:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/open-a-widget-with-keyboard-shortcut/m-p/578679#M13054</guid>
      <dc:creator>RobertAndren</dc:creator>
      <dc:date>2011-03-24T12:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: open a widget with keyboard shortcut</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/open-a-widget-with-keyboard-shortcut/m-p/578680#M13055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Or if you wish to try, here is an xml configurable keyboard shortcut widget.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The widget config file lets you put in the widget label (as defined in the viewers main config xml),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;the key and optional boolean values for ctrl, alt and shift keys. The default for&amp;nbsp; these is false.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;eg&amp;nbsp; key=s and ctrl=true is &lt;/SPAN&gt;&lt;STRONG&gt;CTRL+s&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;key=s and ctrl=false is &lt;/SPAN&gt;&lt;STRONG&gt;s&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Add to your main config file in the UI Elements part&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;lt;!-- UI elements --&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;widget config="widgets/KeyboardShortcuts/KeyboardShortcutsWidget.xml"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url="widgets/KeyboardShortcuts/KeyboardShortcutsWidget.swf"/&amp;gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let me know if you think this is useful, and I can upload to the code gallery with compiled version.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:52:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/open-a-widget-with-keyboard-shortcut/m-p/578680#M13055</guid>
      <dc:creator>MarkHoyland</dc:creator>
      <dc:date>2021-12-12T00:52:06Z</dc:date>
    </item>
  </channel>
</rss>

