comparison examples/togglepanel.ur @ 8:90be8b8917d5

Add a widget that opens and closes a panel.
author Karn Kallio <kkallio@eka>
date Fri, 17 Jun 2011 10:12:05 -0430
parents
children 554e342665fe
comparison
equal deleted inserted replaced
7:48a4180171b0 8:90be8b8917d5
1 open Gui
2 open TogglePanel
3
4 val defaultContent : xbody = <xml><p>Here I am inside the panel.<br/><b>Default format</b></p></xml>
5 val otherContent : xbody = <xml><p>Here I am inside the panel.<br/><b>Other format</b></p></xml>
6
7 val otherFormat = {FormatPanel = fn ctl panel => <xml><span>A Custom {ctl} Format</span>{panel}</xml>,
8 OpenCtl = fn behaviour => <xml><a href={bless "http://#"} onclick={behaviour}>View</a></xml>,
9 CloseCtl = fn behaviour => <xml><a href={bless "http://#"} onclick={behaviour}>Hide</a></xml>}
10
11 fun main () =
12
13 defaultFormatPanel <- create defaultFormat defaultContent True;
14 otherFormatPanel <- create otherFormat otherContent False;
15
16 return <xml>
17 <head>
18 <title>A panel that can be shown or hidden.</title>
19 </head>
20 <body>
21 <h1>Example using the togglePanel widget.</h1>
22 <p>
23 This is a widget which has a content display panel
24 which can be shown or hidden.
25 </p>
26 <h2>Example of the default format, starting open.</h2>
27 <p>
28 {toXml defaultFormatPanel}
29 </p>
30 <h2>Example of another format, starting closed.</h2>
31 <p>
32 {toXml otherFormatPanel}
33 </p>
34 </body>
35 </xml>