Rich UI Tooltip

Rich UI tooltip ウィジェットでは、吹き出しヘルプ を定義します。これは、ユーザーがウィジェットの上に移動すると表示されるテキストまたはウィジェットです。ツールチップは、このセクションの説明に従って tooltip ウィジェットを使用可能にしている場合のみ表示されます。いくつかのウィジェットに同じツールチップを使用することも、ランタイム・イベントに応答して特定のウィジェットでツールチップを使用可能にすることもできます。

以下に、ボタンを表示し、「To toggle the text, click the button!」という吹き出しヘルプを割り当てる Rich UI ハンドラーの例を示します。:
package myPkg;

import com.ibm.egl.rui.widgets.Box;
import com.ibm.egl.rui.widgets.Button;
import com.ibm.egl.rui.widgets.Tooltip;
import egl.ui.rui.Event;


Handler MyHandler Type RUIHandler { initialUI = [theButton], 
                               onConstructionFunction= begin }

   theButton Button { text = "Start", onClick ::= click };
   theToolTip Tooltip { text = "To toggle the text, click the button!", 
                        delay = 800 };
   myBox Box{};

   function begin()
      theToolTip.enable(theButton);
   end

   Function click(e Event in) 
      if (theButton.text == "Start")
         theButton.text = "Stop";
      else
         theButton.text = "Start";
      end
   end
end
以下の tooltip ウィジェット・プロパティーがサポートされます。
  • text。表示する文字列を保持します。ここで文字列を指定する場合は、provider プロパティーは使用されません。
  • delay。ユーザーによる移動の開始と吹き出しヘルプの表示の間のミリ秒数を表す整数を保持します。
  • provider。吹き出しヘルプ内に表示するボックスを戻す関数を参照します。例えば、Rich UI ハンドラーに「Start」を示すボタンが表示されると仮定します。そのボタンで使用可能で、吹き出しヘルプにハイパーテキスト・リンクを表示するツールチップを作成できます。
    ツールチップ・プロバイダー GoToWebsite の出力
    以下に、出力を可能にするプロバイダー関数を示します。
    Function GoToWebsite(myWidget any in) returns(Box)
    	  myLink html{text = 
          "You can rely on <a target = ¥"_blank¥", href=¥"http://www.ibm.com¥">IBM</a>";
    	  myBox.children = [mylink];
    	  return (myBox);
    end
    ToolTipTextProvider という名前の委譲パーツは、provider プロパティーによって参照される任意の関数のアクセス特性を記述します。 特に、委譲パーツは、プロバイダー関数が以下の 1 つのパラメーター・タイプを持ち、ボックスを戻すことを示しています。
    Delegate TooltipTextProvider(widget any in) returns(Box) end

    『Rich UI メモリー管理』に記載されている問題に注意してください。

以下の tooltip ウィジェット関数がサポートされます。
  • enable(widget in) は、最初の例に示すように、特定のウィジェットのツールチップを使用可能にします。
このウィジェットを使用するには、次のステートメントが必要です。
import com.ibm.egl.rui.widgets.ToolTip;