Advertisement
Guest User

Untitled

a guest
Oct 18th, 2010
449
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 1.67 KB | None | 0 0
  1. import dfl.all;
  2. import dfl.scintilla;
  3. import std.stdio : writeln;
  4.  
  5. class MainForm : Form
  6. {
  7.     TabControl tctrl;
  8.     TextBox tab4box;
  9.    
  10.     this()
  11.     {
  12.         with(tctrl = new TabControl)
  13.         {
  14.             TabPage tabPage;  // our reusable variable
  15.            
  16.             tabPage = new TabPage("Tab 1");
  17.             tabPage.backColor = Color(0, 0, 0xDD);
  18.             with(new Scintilla)
  19.             {
  20.                 text = "int foo = 42;\r\n";
  21.                 parent = tabPage;   // tabPage now holds a reference to a Scintilla object
  22.             }
  23.            
  24.             // Scintilla still exists after the with block
  25.            
  26.             // tabPages is a part of TabControl
  27.             // and we can add a tabPage to it.
  28.             tabPages.add(tabPage);  // Now tabPages holds a reference to one tabPage
  29.                                     // which in turn holds a reference to the Scintilla
  30.                                     // object.
  31.            
  32.             // Now we can reuse the tabPage variable
  33.             tabPage = new TabPage("Tab 2");
  34.             tabPage.backColor = Color(0, 0, 0xDD);
  35.             tabPages.add(tabPage);
  36.            
  37.             // ditto
  38.             tabPage = new TabPage("Tab 3");
  39.             tabPage.backColor = Color(0, 0, 0xDD);
  40.             tabPages.add(tabPage);
  41.            
  42.             parent = this;
  43.         }
  44.     }
  45. }
  46.  
  47.  
  48. int main()
  49. {
  50.     int result = 0;
  51.    
  52.     try
  53.     {
  54.         Application.run(new MainForm);
  55.     }
  56.     catch(Object o)
  57.     {
  58.         msgBox(o.toString(), "Fatal Error", MsgBoxButtons.OK, MsgBoxIcon.ERROR);
  59.        
  60.         result = 1;
  61.     }
  62.    
  63.     return result;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement