Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import dfl.all;
- import dfl.scintilla;
- import std.stdio : writeln;
- class MainForm : Form
- {
- TabControl tctrl;
- TextBox tab4box;
- this()
- {
- with(tctrl = new TabControl)
- {
- TabPage tabPage; // our reusable variable
- tabPage = new TabPage("Tab 1");
- tabPage.backColor = Color(0, 0, 0xDD);
- with(new Scintilla)
- {
- text = "int foo = 42;\r\n";
- parent = tabPage; // tabPage now holds a reference to a Scintilla object
- }
- // Scintilla still exists after the with block
- // tabPages is a part of TabControl
- // and we can add a tabPage to it.
- tabPages.add(tabPage); // Now tabPages holds a reference to one tabPage
- // which in turn holds a reference to the Scintilla
- // object.
- // Now we can reuse the tabPage variable
- tabPage = new TabPage("Tab 2");
- tabPage.backColor = Color(0, 0, 0xDD);
- tabPages.add(tabPage);
- // ditto
- tabPage = new TabPage("Tab 3");
- tabPage.backColor = Color(0, 0, 0xDD);
- tabPages.add(tabPage);
- parent = this;
- }
- }
- }
- int main()
- {
- int result = 0;
- try
- {
- Application.run(new MainForm);
- }
- catch(Object o)
- {
- msgBox(o.toString(), "Fatal Error", MsgBoxButtons.OK, MsgBoxIcon.ERROR);
- result = 1;
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement