Make help tooltips more obvious
authorRichard Fairhurst <richard@systemeD.net>
Wed, 22 Aug 2012 13:24:22 +0000 (14:24 +0100)
committerRichard Fairhurst <richard@systemeD.net>
Wed, 22 Aug 2012 13:24:22 +0000 (14:24 +0100)
net/systemeD/potlatch2/mapfeatures/editors/CheckboxEditor.mxml
net/systemeD/potlatch2/mapfeatures/editors/ChoiceEditor.mxml
net/systemeD/potlatch2/mapfeatures/editors/FreeTextEditor.mxml
net/systemeD/potlatch2/mapfeatures/editors/NumberEditor.mxml
net/systemeD/potlatch2/mapfeatures/editors/SingleTagEditor.as
net/systemeD/potlatch2/mapfeatures/editors/SliderEditor.mxml
net/systemeD/potlatch2/mapfeatures/editors/SpeedEditor.mxml
net/systemeD/potlatch2/skins/CustomFormItemSkin.mxml
styles/Application.css

index 03cbe19..6ff06d7 100644 (file)
@@ -6,7 +6,7 @@
        xmlns:edit="net.systemeD.potlatch2.mapfeatures.editors.*"
        xmlns:flexlib="flexlib.controls.*"
        width="100%"
-       toolTip="{fieldDescription}"
+       helpContent="{fieldDescription ? help : null}" 
        label="{fieldName}:">
 
     <mx:CheckBox id="inputBox" creationComplete="initCheckbox()"
index 4bfe220..d9b3bdd 100644 (file)
@@ -4,7 +4,7 @@
        xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:edit="net.systemeD.potlatch2.mapfeatures.editors.*"
-       toolTip="{fieldDescription}"
+       helpContent="{fieldDescription ? help : null}" 
        label="{fieldName}:"
     styleName="titledEditor">
 
index 74ae695..375acd8 100644 (file)
@@ -7,12 +7,13 @@
        xmlns:flexlib="flexlib.controls.*"
        xmlns:controls="net.systemeD.controls.*"
        width="100%"
-       toolTip="{fieldDescription}"
+       helpContent="{fieldDescription ? help : null}" 
     styleName="titledEditor" label="{fieldName}:">
 
     <controls:PromptingTextInputWarning id="inputBox" prompt="{prompt}" text="{value}" width="100%"
       focusOut="value = inputBox.text" enter="value = inputBox.text; focusManager.getNextFocusManagerComponent().setFocus();"
       restrict="&#x0020;-&#x10FFFF;" />
+
   <fx:Script><![CDATA[
       [Bindable(event="factory_set")]
       protected function get prompt():String {
index 7d82614..31f87c9 100644 (file)
@@ -6,7 +6,7 @@
        xmlns:edit="net.systemeD.potlatch2.mapfeatures.editors.*"
        xmlns:flexlib="flexlib.controls.*"
        width="100%"
-       toolTip="{fieldDescription}"
+       helpContent="{fieldDescription ? help : null}" 
        label="{fieldName}:"
     styleName="titledEditor">
 
index 60df3b8..63b11a7 100644 (file)
@@ -51,6 +51,34 @@ package net.systemeD.potlatch2.mapfeatures.editors {
           dispatchEvent(new Event("tag_changed"));
       }
 
+               [Embed(source="../../../../../embedded/help.png")] private var infoIcon:Class;
+
+               import spark.components.*;
+               import mx.managers.ToolTipManager;
+               import mx.controls.ToolTip;
+               import mx.core.IUIComponent;
+               import flash.geom.Point;
+               private var _tip:ToolTip;
+
+               [Bindable(event="factory_set")]
+               protected function get help():Image {
+                       var image:Image = new Image();
+                       image.source = infoIcon;
+                       image.width = 16;
+                       image.height = 16;
+                       image.addEventListener("mouseOver",showHelpBalloon,false,0,true);
+                       image.addEventListener("mouseOut" ,hideHelpBalloon,false,0,true);
+                       return image;
+               }
+
+               private function showHelpBalloon(e:Event):void {
+                       var point:Point=e.target.contentToGlobal(new Point(-8,16));
+                       _tip=ToolTipManager.createToolTip(fieldDescription,point.x,point.y,"errorTipBelow",IUIComponent(e.target)) as ToolTip;
+               }
+               private function hideHelpBalloon(e:Event):void {
+                       ToolTipManager.destroyToolTip(_tip);
+               }
+
     }
 
 }
index ba17e6a..8541944 100644 (file)
@@ -6,7 +6,7 @@
        xmlns:edit="net.systemeD.potlatch2.mapfeatures.editors.*"
        xmlns:flexlib="flexlib.controls.*"
        width="100%"
-       toolTip="{fieldDescription}"
+       helpContent="{fieldDescription ? help : null}" 
        label="{fieldName}:"
        styleName="titledEditor">
 
index 39450d6..ae4b84a 100644 (file)
@@ -3,7 +3,7 @@
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:edit="net.systemeD.potlatch2.mapfeatures.editors.*"
-       toolTip="{fieldDescription}"
+       helpContent="{fieldDescription ? help : null}" 
        label="{fieldName}:"
     styleName="titledEditor">
 
index f03923e..951a902 100644 (file)
@@ -126,7 +126,7 @@ Move the indicator tooltip string to a resource bundle
              bottom="row1:0" baseline="row1:0"/>
     <!--- @copy spark.components.FormItem#labelDisplay -->
     <s:Label id="labelDisplay"
-             fontWeight="bold"
+             maxWidth="75"
              left="labelCol:0" right="labelCol:5" 
              bottom="row1:0" baseline="row1:0"/>  
     <!--- @copy spark.components.SkinnableContainer#contentGroup -->
index f5a6a7e..4a37a84 100644 (file)
@@ -282,6 +282,12 @@ s|FormItem {
        closedIcon: Embed(source="../embedded/CollapsiblePanelAssets.swf", symbol="CollapseButtonOver");
 }
 
+/* Tag tooltips */
+
+.errorTip {
+    borderColor: #2929CE;
+}
+
 /* Toolbox */
 
 .theToolBox {