Select to view content in your preferred language

Hide Widget

926
13
01-24-2011 04:33 AM
CharlesDawley
Occasional Contributor
Is there any way to hide a widget from the screen but still have it active? I would like to have a georss widget open but not have the widget window visible.
Tags (2)
0 Kudos
13 Replies
JonFisher
New Contributor III
Is there any way to hide a widget from the screen but still have it active? I would like to have a georss widget open but not have the widget window visible.


Sure, you can add preload="minimized" into the widget tag which will let the data display but much less real estate will be taken up by the icon. I'm not sure about having it entirely invisible, but to have it load minimized it would look like:
        <widget label="Earthquakes (GeoRSS)"
            preload="minimized"
            icon="assets/images/i_rss.png"
            config="widgets/GeoRSS/GeoRSSWidget.xml"
            url="widgets/GeoRSS/GeoRSSWidget.swf"/>
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Charles,

   If you are using the uncompiled version of the viewer than all you need to do is put visible=false in the widgetTemplate of the geoRSSWidget.

If you are using the compiled version than just set the x and y of the widget in your config file to negative numbers:

<widget label="Earthquakes (GeoRSS)"
            x="-500" y="-500"
            icon="assets/images/i_rss.png"
            config="widgets/GeoRSS/GeoRSSWidget.xml"
            url="widgets/GeoRSS/GeoRSSWidget.swf"/>
0 Kudos
CharlesDawley
Occasional Contributor
Thanks for the response!

I have tried it both ways but when you hover over one of the georss points and click to zoom the widget box appears.

I must be missing something..

Here is my sample map http://pawn.s3.amazonaws.com/flex/index.html

<s:HGroup id="boxMessage"
       width="100%"
       includeInLayout="{msgVisible}"
       visible="{msgVisible}">
    <mx:Image id="swfMessage"
        source="assets/images/loader.swf"
        visible="false"/>
    <mx:Text id="txtMessage"
       width="90%"
       text=""/>
   </s:HGroup>
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Charles,

   This worked for me. Add it to the UI element instead of the widget container and set the widgetTemplate to visible="false"

    <title>Little Traverse Conservancy</title>
    <subtitle>Nature Preserves webmap</subtitle>
    <logo>assets/images/logo.png</logo>
    <style>
        <colors>0x4C2600,0xFFEDB8,0xB2AD81,0x6F6750,0x4C2600</colors>
        <alpha>0.8</alpha>
    </style>

    <!-- UI elements -->
    <widget left="10"  top="50"    config="widgets/Navigation/NavigationWidget.xml" url="widgets/Navigation/NavigationWidget.swf"/>
    <widget right="-2" bottom="-2" config="widgets/OverviewMap/OverviewMapWidget.xml" url="widgets/OverviewMap/OverviewMapWidget.swf"/>
    <widget right="20" top="55"    config="widgets/MapSwitcher/MapSwitcherWidget.xml" url="widgets/MapSwitcher/MapSwitcherWidget.swf"/>
    <widget left="0"   top="0"     config="widgets/HeaderController/HeaderControllerWidget.xml" url="widgets/HeaderController/HeaderControllerWidget.swf"/>
    <widget x="-500" y="-500"      config="widgets/preload/GeoRSSWidget.xml" url="widgets/preload/GeoRSSWidget.swf"/>
0 Kudos
CharlesDawley
Occasional Contributor
I have added it to the UI element in the config.xml. I still must be missing something in editing the mxml. (I am new to mxml)

When the map loads I get just the dots like I want.  But then when you click on the map the georss feed window still pops up..


Config.xml

<!-- UI elements -->
    
    <widget left="10"  top="50"    config="widgets/Navigation/NavigationWidget.xml" url="widgets/Navigation/NavigationWidget.swf"/>
    <widget right="-2" bottom="-2" config="widgets/OverviewMap/OverviewMapWidget.xml" url="widgets/OverviewMap/OverviewMapWidget.swf"/>
    <widget right="20" top="55"    config="widgets/MapSwitcher/MapSwitcherWidget.xml" url="widgets/MapSwitcher/MapSwitcherWidget.swf"/>
    <widget left="0"   top="0"     config="widgets/HeaderController/HeaderControllerWidget.xml" url="widgets/HeaderController/HeaderControllerWidget.swf"/>
 <widget left="-500" top="-500" config="widgets/preload/GeoRSSWidget.xml" url="widgets/preload/GeoRSSWidget.swf"/>
    
 



GeoRSSWidget.mxml

<viewer:WidgetTemplate id="wTemplate"
                           width="330" height="300"
                           closed="widgetClosedHandler(event)"
                           minHeight="100"
                           minWidth="300"
                           open="widgetOpenedHandler(event)">
        <s:NavigatorContent width="100%" height="100%">
            <s:layout>
                <s:VerticalLayout gap="1"/>
            </s:layout>
            <s:HGroup id="boxMessage"
                      width="100%"
                      includeInLayout="{msgVisible}"
                      visible="{msgVisible}">
                <mx:Image id="swfMessage"
                          source="assets/images/loader.swf"
                          visible="false"/>
                <mx:Text id="txtMessage"
                         width="90%"
                         text=""/>
            </s:HGroup>
            <s:Scroller width="100%" height="100%"
                        horizontalScrollPolicy="off">
                <GeoRSS:GeoRSSFeedDataGroup id="geoRSSFeedDG"
                                            dataProvider="{geoRSSFeedAC}"
                                            geoRSSFeedClick="clickGeoRSSFeed(event)"
                                            geoRSSFeedMouseOut="mouseOutGeoRSSFeed(event)"
                                            geoRSSFeedMouseOver="mouseOverGeoRSSFeed(event)">
                    <GeoRSS:layout>
                        <s:VerticalLayout gap="2"
                                          horizontalAlign="justify"
                                          useVirtualLayout="true"/>
                    </GeoRSS:layout>
                </GeoRSS:GeoRSSFeedDataGroup>
            </s:Scroller>
        </s:NavigatorContent>
    </viewer:WidgetTemplate>
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Charles,

Yours:
<viewer:WidgetTemplate id="wTemplate"
                           width="330" height="300"
                           closed="widgetClosedHandler(event)"
                           minHeight="100"
                           minWidth="300"
                           open="widgetOpenedHandler(event)">


What it needs to be:
<viewer:WidgetTemplate id="wTemplate"
                           width="330" height="300"
                           closed="widgetClosedHandler(event)"
                           minHeight="100"
                           minWidth="300"
         visible="false"
                           open="widgetOpenedHandler(event)">
0 Kudos
CharlesDawley
Occasional Contributor
Works perfectly! Thanks so much!

Hope someone else will find this useful..
0 Kudos
FrankRoberts
Occasional Contributor III
Along the same line, is there any way to not have the widget not preload?  On load of the viewer I don�??t want the widget to load up and I don�??t want to see it in the menu.  I do want to call it from other widgets on demand and then have it appear.  Seems like I�??m close by putting it in the UI Elements section, but I�??m missing some way to not have it load.  Would be nice if there was a setting called preload = �??no�?� or preload = �??false�?�, but that doesn�??t seem to be there.

Any ideas?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Frank,

   That is a rather unique use case... I would not add the widget to the UI Section as those widget are expected to be launched and open from the start. I would add it as a regular widget and customize the HeaderControllerWidget to exclude your widget (by label name) from getting a icon added.
0 Kudos