root/trunk/examples/htmlayout/msvs_start_page.d

Revision 17, 1.2 kB (checked in by bobef, 4 years ago)

Updated to HTMLayout 3.2.2.8 and added a new example (see change log for more details)

Line 
1 import flowerd.dfl;
2 import dfl.all;
3
4 class MyForm : HLayoutForm
5 {
6     this()
7     {
8         super();
9         form.text="M$VS start page demo";
10         form.size=Size(800,700);
11         form.centerToScreen();
12
13         setOption(HTMLAYOUT_FONT_SMOOTHING,3); // force ClearType
14
15         HLayoutBase.handleEvent(&onDomReady);   //this handler is used for both
16                                                 //HLN_DOCUMENT_COMPLETE - document fully complete
17                                                 //HLN_DOCUMENT_LOADED - dom tree ready
18
19         loadHTML("msvs_start_page/start-page.htm");
20     }
21
22     bool onDomReady(HReady event)
23     {
24         if(event.event!=HLN_DOCUMENT_COMPLETE) return false;
25
26         with(rootElement.select("li",1)[0])
27         {
28             innerHTML="<div style=\"color: green; font-weight: bold;\">THIS IS THE FIRST LI</div>";
29             update; //you need to call update to redraw elements
30         }
31
32         rootElement.getId("mybutton").handleStatic(delegate(HBehaviorEvent p)
33         {
34             if(p.cmd==BUTTON_CLICK)
35             {
36                 msgBox("... "~p.element.innerText~" !","You have clicked ...",MsgBoxButtons.OK,MsgBoxIcon.INFORMATION);
37                 return true; //handled the event
38             }
39             return false; //call other handlers
40         });
41
42         return true;
43     }
44 }
45
46 void main()
47 {
48     htmlayout.capi.loadHTMLayout(); //load the dll
49     Application.run(cast(Form)new MyForm);
50 }
Note: See TracBrowser for help on using the browser.