1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="previous" href="ThreadUnix.html">
<link rel="next" href="Unix.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Arg" rel="Chapter" href="Arg.html">
<link title="Arith_status" rel="Chapter" href="Arith_status.html">
<link title="Array" rel="Chapter" href="Array.html">
<link title="ArrayLabels" rel="Chapter" href="ArrayLabels.html">
<link title="Big_int" rel="Chapter" href="Big_int.html">
<link title="Bigarray" rel="Chapter" href="Bigarray.html">
<link title="Buffer" rel="Chapter" href="Buffer.html">
<link title="Callback" rel="Chapter" href="Callback.html">
<link title="CamlinternalMod" rel="Chapter" href="CamlinternalMod.html">
<link title="CamlinternalOO" rel="Chapter" href="CamlinternalOO.html">
<link title="Char" rel="Chapter" href="Char.html">
<link title="Complex" rel="Chapter" href="Complex.html">
<link title="Condition" rel="Chapter" href="Condition.html">
<link title="Dbm" rel="Chapter" href="Dbm.html">
<link title="Digest" rel="Chapter" href="Digest.html">
<link title="Dynlink" rel="Chapter" href="Dynlink.html">
<link title="Event" rel="Chapter" href="Event.html">
<link title="Filename" rel="Chapter" href="Filename.html">
<link title="Format" rel="Chapter" href="Format.html">
<link title="Gc" rel="Chapter" href="Gc.html">
<link title="Genlex" rel="Chapter" href="Genlex.html">
<link title="Graphics" rel="Chapter" href="Graphics.html">
<link title="GraphicsX11" rel="Chapter" href="GraphicsX11.html">
<link title="Hashtbl" rel="Chapter" href="Hashtbl.html">
<link title="Int32" rel="Chapter" href="Int32.html">
<link title="Int64" rel="Chapter" href="Int64.html">
<link title="Lazy" rel="Chapter" href="Lazy.html">
<link title="Lexing" rel="Chapter" href="Lexing.html">
<link title="List" rel="Chapter" href="List.html">
<link title="ListLabels" rel="Chapter" href="ListLabels.html">
<link title="Map" rel="Chapter" href="Map.html">
<link title="Marshal" rel="Chapter" href="Marshal.html">
<link title="MoreLabels" rel="Chapter" href="MoreLabels.html">
<link title="Mutex" rel="Chapter" href="Mutex.html">
<link title="Nativeint" rel="Chapter" href="Nativeint.html">
<link title="Num" rel="Chapter" href="Num.html">
<link title="Obj" rel="Chapter" href="Obj.html">
<link title="Oo" rel="Chapter" href="Oo.html">
<link title="Parsing" rel="Chapter" href="Parsing.html">
<link title="Pervasives" rel="Chapter" href="Pervasives.html">
<link title="Printexc" rel="Chapter" href="Printexc.html">
<link title="Printf" rel="Chapter" href="Printf.html">
<link title="Queue" rel="Chapter" href="Queue.html">
<link title="Random" rel="Chapter" href="Random.html">
<link title="Scanf" rel="Chapter" href="Scanf.html">
<link title="Set" rel="Chapter" href="Set.html">
<link title="Sort" rel="Chapter" href="Sort.html">
<link title="Stack" rel="Chapter" href="Stack.html">
<link title="StdLabels" rel="Chapter" href="StdLabels.html">
<link title="Str" rel="Chapter" href="Str.html">
<link title="Stream" rel="Chapter" href="Stream.html">
<link title="String" rel="Chapter" href="String.html">
<link title="StringLabels" rel="Chapter" href="StringLabels.html">
<link title="Sys" rel="Chapter" href="Sys.html">
<link title="Thread" rel="Chapter" href="Thread.html">
<link title="ThreadUnix" rel="Chapter" href="ThreadUnix.html">
<link title="Tk" rel="Chapter" href="Tk.html">
<link title="Unix" rel="Chapter" href="Unix.html">
<link title="UnixLabels" rel="Chapter" href="UnixLabels.html">
<link title="Weak" rel="Chapter" href="Weak.html"><link title="Initialization and termination" rel="Section" href="#6_Initializationandtermination">
<link title="Application wide commands" rel="Section" href="#6_Applicationwidecommands">
<link title="Dimensions" rel="Section" href="#6_Dimensions">
<link title="Widget layout commands" rel="Section" href="#6_Widgetlayoutcommands">
<link title="Event handling" rel="Section" href="#6_Eventhandling">
<title>Tk</title>
</head>
<body>
<div class="navbar"><a href="ThreadUnix.html">Previous</a>
<a href="index.html">Up</a>
<a href="Unix.html">Next</a>
</div>
<center><h1>Module <a href="type_Tk.html">Tk</a></h1></center>
<br>
<pre><span class="keyword">module</span> Tk: <code class="code"><span class="keyword">sig</span></code> <a href="Tk.html">..</a> <code class="code"><span class="keyword">end</span></code></pre>Basic functions and types for LablTk<br>
<hr width="100%">
<br>
<a name="6_Initializationandtermination"></a>
<h6>Initialization and termination</h6><br>
<pre><span class="keyword">val</span> <a name="VALopenTk"></a>openTk : <code class="type">?display:string -> ?clas:string -> unit -> Widget.toplevel Widget.widget</code></pre><div class="info">
Initialize LablTk and open a toplevel window.
<code class="code">display</code> is described according to the X11 conventions.
<code class="code">clas</code> is used for the X11 resource mechanism.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALmainLoop"></a>mainLoop : <code class="type">unit -> unit</code></pre><div class="info">
Start the main event loop<br>
</div>
<pre><span class="keyword">val</span> <a name="VALcloseTk"></a>closeTk : <code class="type">unit -> unit</code></pre><div class="info">
Quit the main loop and close all open windows.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALdestroy"></a>destroy : <code class="type">'a Widget.widget -> unit</code></pre><div class="info">
Destroy an individual widget.<br>
</div>
<br>
<a name="6_Applicationwidecommands"></a>
<h6>Application wide commands</h6><br>
<pre><span class="keyword">val</span> <a name="VALupdate"></a>update : <code class="type">unit -> unit</code></pre><div class="info">
Synchronize display with internal state.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALappname_get"></a>appname_get : <code class="type">unit -> string</code></pre><pre><span class="keyword">val</span> <a name="VALappname_set"></a>appname_set : <code class="type">string -> unit</code></pre><div class="info">
Get or set the application name.<br>
</div>
<br>
<a name="6_Dimensions"></a>
<h6>Dimensions</h6><br>
<pre><span class="keyword">type</span> <a name="TYPEunits"></a><code class="type"></code>units = <code class="type">[ `Cm of float | `In of float | `Mm of float | `Pix of int | `Pt of float ]</code> </pre>
<pre><span class="keyword">val</span> <a name="VALpixels"></a>pixels : <code class="type"><a href="Tk.html#TYPEunits">units</a> -> int</code></pre><div class="info">
Converts various on-screen units to pixels,
respective to the default display. Available units are
pixels, centimeters, inches, millimeters and points<br>
</div>
<br>
<a name="6_Widgetlayoutcommands"></a>
<h6>Widget layout commands</h6><br>
<pre><span class="keyword">type</span> <a name="TYPEanchor"></a><code class="type"></code>anchor = <code class="type">[ `Center | `E | `N | `Ne | `Nw | `S | `Se | `Sw | `W ]</code> </pre>
<pre><span class="keyword">type</span> <a name="TYPEfillMode"></a><code class="type"></code>fillMode = <code class="type">[ `Both | `None | `X | `Y ]</code> </pre>
<pre><span class="keyword">type</span> <a name="TYPEside"></a><code class="type"></code>side = <code class="type">[ `Bottom | `Left | `Right | `Top ]</code> </pre>
<pre><span class="keyword">val</span> <a name="VALpack"></a>pack : <code class="type">?after:'a Widget.widget -><br> ?anchor:<a href="Tk.html#TYPEanchor">anchor</a> -><br> ?before:'b Widget.widget -><br> ?expand:bool -><br> ?fill:<a href="Tk.html#TYPEfillMode">fillMode</a> -><br> ?inside:'c Widget.widget -><br> ?ipadx:int -><br> ?ipady:int -><br> ?padx:int -> ?pady:int -> ?side:<a href="Tk.html#TYPEside">side</a> -> 'd Widget.widget list -> unit</code></pre><div class="info">
Pack a widget inside its parent,
using the standard layout engine.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALgrid"></a>grid : <code class="type">?column:int -><br> ?columnspan:int -><br> ?inside:'a Widget.widget -><br> ?ipadx:int -><br> ?ipady:int -><br> ?padx:int -><br> ?pady:int -><br> ?row:int -> ?rowspan:int -> ?sticky:string -> 'b Widget.widget list -> unit</code></pre><div class="info">
Pack a widget inside its parent, using the grid layout engine.<br>
</div>
<pre><span class="keyword">type</span> <a name="TYPEborderMode"></a><code class="type"></code>borderMode = <code class="type">[ `Ignore | `Inside | `Outside ]</code> </pre>
<pre><span class="keyword">val</span> <a name="VALplace"></a>place : <code class="type">?anchor:<a href="Tk.html#TYPEanchor">anchor</a> -><br> ?bordermode:<a href="Tk.html#TYPEborderMode">borderMode</a> -><br> ?height:int -><br> ?inside:'a Widget.widget -><br> ?relheight:float -><br> ?relwidth:float -><br> ?relx:float -><br> ?rely:float -> ?width:int -> ?x:int -> ?y:int -> 'b Widget.widget -> unit</code></pre><div class="info">
Pack a widget inside its parent, at absolute coordinates.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALraise_window"></a>raise_window : <code class="type">?above:'a Widget.widget -> 'b Widget.widget -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALlower_window"></a>lower_window : <code class="type">?below:'a Widget.widget -> 'b Widget.widget -> unit</code></pre><div class="info">
Raise or lower the window associated to a widget.<br>
</div>
<br>
<a name="6_Eventhandling"></a>
<h6>Event handling</h6><br>
<pre><span class="keyword">type</span> <a name="TYPEmodifier"></a><code class="type"></code>modifier = <code class="type">[ `Alt<br> | `Button1<br> | `Button2<br> | `Button3<br> | `Button4<br> | `Button5<br> | `Control<br> | `Double<br> | `Lock<br> | `Meta<br> | `Mod1<br> | `Mod2<br> | `Mod3<br> | `Mod4<br> | `Mod5<br> | `Shift<br> | `Triple ]</code> </pre>
<pre><span class="keyword">type</span> <a name="TYPEevent"></a><code class="type"></code>event = <code class="type">[ `ButtonPress<br> | `ButtonPressDetail of int<br> | `ButtonRelease<br> | `ButtonReleaseDetail of int<br> | `Circulate<br> | `ColorMap<br> | `Configure<br> | `Destroy<br> | `Enter<br> | `Expose<br> | `FocusIn<br> | `FocusOut<br> | `Gravity<br> | `KeyPress<br> | `KeyPressDetail of string<br> | `KeyRelease<br> | `KeyReleaseDetail of string<br> | `Leave<br> | `Map<br> | `Modified of <a href="Tk.html#TYPEmodifier">modifier</a> list * <a href="Tk.html#TYPEevent">event</a><br> | `Motion<br> | `Property<br> | `Reparent<br> | `Unmap<br> | `Visibility ]</code> </pre>
<br>
An event can be either a basic X event, or modified by a
key or mouse modifier.<br>
<br><code><span class="keyword">type</span> <a name="TYPEeventInfo"></a><code class="type"></code>eventInfo = {</code><table class="typetable">
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_Above : <code class="type">int</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_ButtonNumber : <code class="type">int</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_Count : <code class="type">int</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_Detail : <code class="type">string</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_Focus : <code class="type">bool</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_Height : <code class="type">int</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_KeyCode : <code class="type">int</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_Mode : <code class="type">string</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_OverrideRedirect : <code class="type">bool</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_Place : <code class="type">string</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_State : <code class="type">string</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_Time : <code class="type">int</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_Width : <code class="type">int</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_MouseX : <code class="type">int</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_MouseY : <code class="type">int</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_Char : <code class="type">string</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_BorderWidth : <code class="type">int</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_SendEvent : <code class="type">bool</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_KeySymString : <code class="type">string</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_KeySymInt : <code class="type">int</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_RootWindow : <code class="type">int</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_SubWindow : <code class="type">int</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_Type : <code class="type">int</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_Widget : <code class="type">Widget.any Widget.widget</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_RootX : <code class="type">int</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable </span>ev_RootY : <code class="type">int</code>;</code></td>
</tr></table>
}
<br>
Event related information accessible in callbacks.<br>
<pre><span class="keyword">type</span> <a name="TYPEeventField"></a><code class="type"></code>eventField = <code class="type">[ `Above<br> | `BorderWidth<br> | `ButtonNumber<br> | `Char<br> | `Count<br> | `Detail<br> | `Focus<br> | `Height<br> | `KeyCode<br> | `KeySymInt<br> | `KeySymString<br> | `Mode<br> | `MouseX<br> | `MouseY<br> | `OverrideRedirect<br> | `Place<br> | `RootWindow<br> | `RootX<br> | `RootY<br> | `SendEvent<br> | `State<br> | `SubWindow<br> | `Time<br> | `Type<br> | `Widget<br> | `Width ]</code> </pre>
<br>
In order to access the above event information, one has to pass
a list of required event fields to the <code class="code">bind</code> function.<br>
<pre><span class="keyword">val</span> <a name="VALbind"></a>bind : <code class="type">events:<a href="Tk.html#TYPEevent">event</a> list -><br> ?extend:bool -><br> ?breakable:bool -><br> ?fields:<a href="Tk.html#TYPEeventField">eventField</a> list -><br> ?action:(<a href="Tk.html#TYPEeventInfo">eventInfo</a> -> unit) -> 'a Widget.widget -> unit</code></pre><div class="info">
Bind a succession of <code class="code">events</code> on a widget to an <code class="code">action</code>.
If <code class="code">extend</code> is true then then binding is added after existing
ones, otherwise it replaces them.
<code class="code">breakable</code> should be true when <code class="code">break</code> is to be called inside
the action.
<code class="code">action</code> is called with the <code class="code">fields</code> required set in
an <code class="code">eventInfo</code> structure. Other fields should not be accessed.
If <code class="code">action</code> is omitted then existing bindings are removed.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALbind_class"></a>bind_class : <code class="type">events:<a href="Tk.html#TYPEevent">event</a> list -><br> ?extend:bool -><br> ?breakable:bool -><br> ?fields:<a href="Tk.html#TYPEeventField">eventField</a> list -><br> ?action:(<a href="Tk.html#TYPEeventInfo">eventInfo</a> -> unit) -> ?on:'a Widget.widget -> string -> unit</code></pre><div class="info">
Same thing for all widgets of a given class. If a widget
is given with label <code class="code">~on:</code>, the binding will be removed as
soon as it is destroyed.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALbind_tag"></a>bind_tag : <code class="type">events:<a href="Tk.html#TYPEevent">event</a> list -><br> ?extend:bool -><br> ?breakable:bool -><br> ?fields:<a href="Tk.html#TYPEeventField">eventField</a> list -><br> ?action:(<a href="Tk.html#TYPEeventInfo">eventInfo</a> -> unit) -> ?on:'a Widget.widget -> string -> unit</code></pre><div class="info">
Same thing for all widgets having a given tag<br>
</div>
<pre><span class="keyword">val</span> <a name="VALbreak"></a>break : <code class="type">unit -> unit</code></pre><div class="info">
Used inside a bound action, do not call other actions
after this one. This is only possible if this action
was bound with <code class="code">~breakable:<span class="keyword">true</span></code>.<br>
</div>
</body></html>
|