Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-15345

TooltipManager improperly positions error tips

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • Adobe Flex SDK 3.0 (Release)
    • None
    • Tooltip Manager
    • None
    • Affected OS(s): All OS Platforms
      Affected OS(s): All OS Platforms
      Language Found: English

    Description

      The following code is taken from ToolTipManagerImpl.positionTip()

      In the error case (the first if) it correctly checks to see if the tip will fit, if not, it sets a max width, resets the text, and then resets the max width. The assumption is the text setter function will reformat the text. But it doesn't, it doesn't, it just invalidates it, updateDisplayList gets called later.

      The non-error case correctly adjusts the x postion to make the tip fit, I think the error case should do this too.

      Run the test app i have included below. Click in the eithe text input field and then click on the other to get the validator to run, then roll over each input field and notice that the non-error tip moves left but the error tip won't.

      In our app we don't use the standard tooltip skin so for the error tips we don't have the problem you will have with the connecting arrow thing.

      // If the error tip would be too wide for the stage,
      // reduce the maximum width to fit onstage. Note that
      // we have to reassign the text in order to get the tip
      // to relayout after changing the border style and maxWidth.
      if (x + currentToolTip.width + 4 > screenWidth)
      {
      newWidth = screenWidth - x - 4;
      oldWidth = Object(toolTipClass).maxWidth;
      Object(toolTipClass).maxWidth = newWidth;
      If (currentToolTip is IStyleClient)
      IStyleClient(currentToolTip).setStyle("borderStyle", "errorTipAbove");
      currentToolTip["text"] = currentToolTip["text"];
      Object(toolTipClass).maxWidth = oldWidth;
      }

      The problem with this code is the max width is set, the tooltip text is set under the assumption the text will relayout. The problem is that the layout happens asynchronously and at the point it happens, the max width is back to what it was.
      // If the tooltip is too wide to fit onstage, move it left.
      var toolTipWidth:Number = currentToolTip.width;
      if (x + toolTipWidth > screenWidth)
      x = screenWidth - toolTipWidth;

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application
      xmlns:mx="http://www.adobe.com/2006/mxml"
      layout="absolute"
      pageTitle="Zero-G Gallery"
      usePreloader="false"
      autoLayout="true"
      width="238"
      height="338"
      paddingTop="0" paddingBottom="0" xmlns:src="src." xmlns:local="">

      <mx:StringValidator minLength="1" source="

      {t1}

      " property="text" requiredFieldError="wow this is a rockin' tooltip isn't it" />
      <mx:StringValidator minLength="1" source="

      {t2}

      " property="text" requiredFieldError="wow this is a rockin' tooltip isn't it" />
      <mx:TextInput id="t1" toolTip="wow this is a rockin' tooltip isn't it" x="78" y="127"/>
      <mx:TextInput id="t2" toolTip="wow this is a rockin' tooltip isn't it" x="78" y="157"/>

      </mx:Application>

      Attachments

        Activity

          People

            adobejira Adobe JIRA
            adobejira Adobe JIRA
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: