home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 May / Chip_2000-05_cd1.bin / zkuste / Perl / ActivePerl-5.6.0.613.msi / 䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥 / _871597b81d33c8fa5283f8fef6816e7e < prev    next >
Text File  |  2000-03-23  |  13KB  |  289 lines

  1.  
  2. <HTML>
  3. <HEAD>
  4. <TITLE>Tk::Balloon - pop up help balloons.</TITLE>
  5. <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
  6. <LINK REV="made" HREF="mailto:">
  7. </HEAD>
  8.  
  9. <BODY>
  10. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  11. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  12. <STRONG><P CLASS=block> Tk::Balloon - pop up help balloons.</P></STRONG>
  13. </TD></TR>
  14. </TABLE>
  15.  
  16. <A NAME="__index__"></A>
  17. <!-- INDEX BEGIN -->
  18.  
  19. <UL>
  20.  
  21.     <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
  22.  
  23.     <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
  24.     <LI><A HREF="#description">DESCRIPTION</A></LI>
  25.     <UL>
  26.  
  27.         <LI><A HREF="#balloons and menus">Balloons and Menus</A></LI>
  28.         <LI><A HREF="#balloons and canvases">Balloons and Canvases</A></LI>
  29.     </UL>
  30.  
  31.     <LI><A HREF="#options">OPTIONS</A></LI>
  32.     <LI><A HREF="#methods">METHODS</A></LI>
  33.     <UL>
  34.  
  35.         <LI><A HREF="#attach(widget, options)"><STRONG>attach(</STRONG><EM>widget</EM>, <EM>options</EM><STRONG>)</STRONG></A></LI>
  36.         <LI><A HREF="#detach(widget)"><STRONG>detach(</STRONG><EM>widget</EM><STRONG>)</STRONG></A></LI>
  37.         <LI><A HREF="#destroy"><STRONG>destroy</STRONG></A></LI>
  38.     </UL>
  39.  
  40.     <LI><A HREF="#examples">EXAMPLES</A></LI>
  41.     <LI><A HREF="#notes">NOTES</A></LI>
  42.     <LI><A HREF="#caveats">CAVEATS</A></LI>
  43.     <LI><A HREF="#bugs">BUGS</A></LI>
  44.     <LI><A HREF="#authors">AUTHORS</A></LI>
  45.     <LI><A HREF="#history">HISTORY</A></LI>
  46. </UL>
  47. <!-- INDEX END -->
  48.  
  49. <HR>
  50. <P>
  51. <H1><A NAME="name">NAME</A></H1>
  52. <P>Tk::Balloon - pop up help balloons.</P>
  53. <P>
  54. <HR>
  55. <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
  56. <UL>
  57. <LI>Linux</LI>
  58. <LI>Solaris</LI>
  59. <LI>Windows</LI>
  60. </UL>
  61. <HR>
  62. <H1><A NAME="synopsis">SYNOPSIS</A></H1>
  63. <PRE>
  64.     use Tk::Balloon;
  65.     ...
  66.     $b = $top->Balloon(-statusbar => $status_bar_widget);</PRE>
  67. <PRE>
  68.     # Normal Balloon:
  69.     $b->attach($widget,
  70.                -balloonmsg => "Balloon help message",
  71.                -statusmsg => "Status bar message");</PRE>
  72. <PRE>
  73.     # Balloon attached to entries in a menu widget:
  74.     $b->attach($menu, -state => 'status',
  75.                       -msg => ['first menu entry',
  76.                                'second menu entry',
  77.                                ...
  78.                               ],
  79.               );</PRE>
  80. <PRE>
  81.     # Balloon attached to individual items in a canvas widget:
  82.     $b->attach($canvas, -balloonposition => 'mouse',
  83.                         -msg => {'item1' => 'msg1',
  84.                                  'tag2'  => 'msg2',
  85.                                   ...
  86.                                 },
  87.               );</PRE>
  88. <P>
  89. <HR>
  90. <H1><A NAME="description">DESCRIPTION</A></H1>
  91. <P><STRONG>Balloon</STRONG> provides the framework to create and attach help
  92. balloons to various widgets so that when the mouse pauses over the
  93. widget for more than a specified amount of time, a help balloon is
  94. popped up.</P>
  95. <P>
  96. <H2><A NAME="balloons and menus">Balloons and Menus</A></H2>
  97. <P>If the balloon is attached to a <STRONG>Menu</STRONG> widget and the message arguments
  98. are array references, then each element in the array will be the
  99. message corresponding to a menu entry. The balloon message will then
  100. be shown for the entry which the mouse pauses over. Otherwise it is
  101. assumed that the balloon is to be attached to the <STRONG>Menu</STRONG> as a whole.
  102. You can have separate status and balloon messages just like normal
  103. balloons.</P>
  104. <P>
  105. <H2><A NAME="balloons and canvases">Balloons and Canvases</A></H2>
  106. <P>If the balloon is attached to a <STRONG>Canvas</STRONG> widget and the message
  107. arguments are hash references, then each hash key should correspond to
  108. a canvas item ID or tag and the associated value will correspond to the
  109. message for that canvas item. The balloon message will then be shown for
  110. the current item (the one at the position of the mouse). Otherwise it is
  111. assumed that the balloon is to be attached to the <STRONG>Canvas</STRONG> as a whole.
  112. You can have separate status and balloon messages just like normal
  113. balloons.</P>
  114. <P>
  115. <HR>
  116. <H1><A NAME="options">OPTIONS</A></H1>
  117. <P><STRONG>Balloon</STRONG> accepts all of the options that the <STRONG>Frame</STRONG> widget
  118. accepts. In addition, the following options are also recognized.</P>
  119. <DL>
  120. <DT><STRONG><A NAME="item_%2Dinitwait"><STRONG>-initwait</STRONG></A></STRONG><BR>
  121. <DD>
  122. Specifies the amount of time to wait without activity before
  123. popping up a help balloon. Specified in milliseconds. Defaults to
  124. 350 milliseconds. This applies to both the popped up balloon and
  125. the status bar message.
  126. <P></P>
  127. <DT><STRONG><A NAME="item_%2Dstate"><STRONG>-state</STRONG></A></STRONG><BR>
  128. <DD>
  129. Can be one of <STRONG>'balloon'</STRONG>, <STRONG>'status'</STRONG>, <STRONG>'both'</STRONG> or <STRONG>'none'</STRONG>
  130. indicating that the help balloon, status bar help, both or none
  131. respectively should be activated when the mouse pauses over the
  132. client widget. Default is <STRONG>'both'</STRONG>.
  133. <P></P>
  134. <DT><STRONG><A NAME="item_%2Dstatusbar"><STRONG>-statusbar</STRONG></A></STRONG><BR>
  135. <DD>
  136. Specifies the widget used to display the status message. This
  137. widget should accept the <STRONG>-text</STRONG> option and is typically a
  138. <STRONG>Label</STRONG>. If the widget accepts the <STRONG>-textvariable</STRONG> option and
  139. that option is defined then it is used instead of the <STRONG>-text</STRONG>
  140. option.
  141. <P></P>
  142. <DT><STRONG><A NAME="item_%2Dballoonposition"><STRONG>-balloonposition</STRONG></A></STRONG><BR>
  143. <DD>
  144. Can be one of <STRONG>'widget'</STRONG> or <STRONG>'mouse'</STRONG>. It controls where the balloon
  145. will popup. <STRONG>'widget'</STRONG> makes the balloon appear at the lower right
  146. corner of the widget it is attached to (default), and <STRONG>'mouse'</STRONG> makes
  147. the balloon appear below and to the right of the current mouse position.
  148. <P></P>
  149. <DT><STRONG><A NAME="item_%2Dpostcommand"><STRONG>-postcommand</STRONG></A></STRONG><BR>
  150. <DD>
  151. This option takes a <STRONG>CODE</STRONG> reference which will be executed before the
  152. balloon and statusbar messages are displayed and should return a true
  153. or false value to indicate whether you want the balloon to be displayed
  154. or not. This also lets you control where the balloon is positioned by
  155. returning a true value that looks like <EM>X,Y</EM> (matches this regular
  156. expression: <CODE>/^(\d+),(\d+)$/</CODE>). If the postcommand returns a value that
  157. matches that re then those coordinates will be used as the position to
  158. post the balloon. <EM>Warning:</EM> this subroutine should return quickly or
  159. the balloon response will appear slow.
  160. <P></P>
  161. <DT><STRONG><A NAME="item_%2Dcancelcommand"><STRONG>-cancelcommand</STRONG></A></STRONG><BR>
  162. <DD>
  163. This option takes a <STRONG>CODE</STRONG> reference which will be executed before the
  164. balloon and statusbar messages are canceled and should return a true
  165. or false value to indicate whether you want the balloon to be canceled
  166. or not. <EM>Warning:</EM> this subroutine should return quickly or the balloon
  167. response will appear slow.
  168. <P></P>
  169. <DT><STRONG><A NAME="item_%2Dmotioncommand"><STRONG>-motioncommand</STRONG></A></STRONG><BR>
  170. <DD>
  171. This option takes a <STRONG>CODE</STRONG> reference which will be executed for any
  172. motion event and should return a true or false value to indicate
  173. whether the currently displayed balloon should be canceled (deactivated).
  174. If it returns true then the balloon will definitely be canceled, if it
  175. returns false then it may still be canceled depending the internal rules.
  176. <EM>Note:</EM> a new balloon may be posted after the <STRONG>-initwait</STRONG> time
  177. interval, use the <STRONG>-postcommand</STRONG> option to control that behavior.
  178. <EM>Warning:</EM> the subroutine should be extremely fast or the balloon
  179. response will appear slow and consume a lot of CPU time (it is executed
  180. every time the mouse moves over the widgets the balloon is attached to).
  181. <P></P></DL>
  182. <P>
  183. <HR>
  184. <H1><A NAME="methods">METHODS</A></H1>
  185. <P>The <STRONG>Balloon</STRONG> widget supports only three non-standard methods:</P>
  186. <P>
  187. <H2><A NAME="attach(widget, options)"><STRONG>attach(</STRONG><EM>widget</EM>, <EM>options</EM><STRONG>)</STRONG></A></H2>
  188. <P>Attaches the widget indicated by <EM>widget</EM> to the help system. The
  189. allowed options are:</P>
  190. <DL>
  191. <DT><STRONG><A NAME="item_%2Dstatusmsg"><STRONG>-statusmsg</STRONG></A></STRONG><BR>
  192. <DD>
  193. The argument is the message to be shown on the status bar when the
  194. mouse pauses over this client. If this is not specified, but
  195. <STRONG>-msg</STRONG> is specified then the message displayed on the status bar
  196. is the same as the argument for <STRONG>-msg</STRONG>. If you give it a scalar
  197. reference then it is dereferenced before being displayed. Useful
  198. if the postcommand is used to change the message.
  199. <P></P>
  200. <DT><STRONG><A NAME="item_%2Dballoonmsg"><STRONG>-balloonmsg</STRONG></A></STRONG><BR>
  201. <DD>
  202. The argument is the message to be displayed in the balloon that
  203. will be popped up when the mouse pauses over this client. As with
  204. <STRONG>-statusmsg</STRONG> if this is not specified, then it takes its value
  205. from the <STRONG>-msg</STRONG> specification if any. If neither <STRONG>-balloonmsg</STRONG>
  206. nor <STRONG>-msg</STRONG> are specified, or they are the empty string then
  207. no balloon is popped up instead of an empty balloon. If you
  208. give it a scalar reference then it is dereferenced before being
  209. displayed. Useful if the postcommand is used to change the message.
  210. <P></P>
  211. <DT><STRONG><A NAME="item_%2Dmsg"><STRONG>-msg</STRONG></A></STRONG><BR>
  212. <DD>
  213. The catch-all for <STRONG>-statusmsg</STRONG> and <STRONG>-balloonmsg</STRONG>. This is a
  214. convenient way of specifying the same message to be displayed in
  215. both the balloon and the status bar for the client.
  216. <P></P>
  217. <DT><STRONG><STRONG>-initwait</STRONG></STRONG><BR>
  218. <DD>
  219. <DT><STRONG><STRONG>-state</STRONG></STRONG><BR>
  220. <DD>
  221. <DT><STRONG><STRONG>-statusbar</STRONG></STRONG><BR>
  222. <DD>
  223. <DT><STRONG><STRONG>-balloonposition</STRONG></STRONG><BR>
  224. <DD>
  225. <DT><STRONG><STRONG>-postcommand</STRONG></STRONG><BR>
  226. <DD>
  227. <DT><STRONG><STRONG>-cancelcommand</STRONG></STRONG><BR>
  228. <DD>
  229. <DT><STRONG><STRONG>-motioncommand</STRONG></STRONG><BR>
  230. <DD>
  231. These options allow you to override the balloon's default value for
  232. those option for some of the widgets it is attached to. It accepts the
  233. same values as above and will default to the <STRONG>Balloon</STRONG>'s value.
  234. <P></P></DL>
  235. <P>
  236. <H2><A NAME="detach(widget)"><STRONG>detach(</STRONG><EM>widget</EM><STRONG>)</STRONG></A></H2>
  237. <P>Detaches the specified <EM>widget</EM> from the help system.</P>
  238. <P>
  239. <H2><A NAME="destroy"><STRONG>destroy</STRONG></A></H2>
  240. <P>Destroys the specified balloon.</P>
  241. <P>
  242. <HR>
  243. <H1><A NAME="examples">EXAMPLES</A></H1>
  244. <P>See the balloon demo included with the widget demo script that came with
  245. the distribution for examples on various ways to use balloons.</P>
  246. <P>
  247. <HR>
  248. <H1><A NAME="notes">NOTES</A></H1>
  249. <P>Because of the overhead associated with each balloon you create (from
  250. tracking the mouse movement to know when to activate and deactivate
  251. them) you will see the best performance (low CPU consumption) if you
  252. create as few balloons as possible and attach them to as many widgets
  253. as you can.  In other words, don't create a balloon for each widget
  254. you want to attach one to.</P>
  255. <P>
  256. <HR>
  257. <H1><A NAME="caveats">CAVEATS</A></H1>
  258. <P>Pressing any button will deactivate (cancel) the current balloon,
  259. if one exists. You can usually make the balloon reappear by moving
  260. the mouse a little. Creative use of the 3 command options can help
  261. you out also. If the mouse is over the balloon when a menu is unposted
  262. then the balloon will remain until you move off of it.</P>
  263. <P>
  264. <HR>
  265. <H1><A NAME="bugs">BUGS</A></H1>
  266. <P>Hopefully none, probably some.</P>
  267. <P>
  268. <HR>
  269. <H1><A NAME="authors">AUTHORS</A></H1>
  270. <P><STRONG>Rajappa Iyer</STRONG> <A HREF="mailto:rsi@earthling.net">rsi@earthling.net</A> did the original coding.</P>
  271. <P><STRONG>Jason A. Smith</STRONG> <<A HREF="mailto:smithj4@rpi.edu">smithj4@rpi.edu</A>> added support for menus and made some
  272. other enhancements.</P>
  273. <P><STRONG>Slaven Rezic</STRONG> <<A HREF="mailto:eserte@cs.tu-berlin.de">eserte@cs.tu-berlin.de</A>> added support for canvas items.</P>
  274. <P>
  275. <HR>
  276. <H1><A NAME="history">HISTORY</A></H1>
  277. <P>The code and documentation was derived from Balloon.tcl from the
  278. Tix4.0 distribution by Ioi Lam and modified by the above mentioned
  279. authors. This code may be redistributed under the same terms as Perl.</P>
  280. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  281. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  282. <STRONG><P CLASS=block> Tk::Balloon - pop up help balloons.</P></STRONG>
  283. </TD></TR>
  284. </TABLE>
  285.  
  286. </BODY>
  287.  
  288. </HTML>
  289.