<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Tutorial</title><link>https://sourceforge.net/p/uil/wiki/Tutorial/</link><description>Recent changes to Tutorial</description><atom:link href="https://sourceforge.net/p/uil/wiki/Tutorial/feed" rel="self"/><language>en</language><lastBuildDate>Fri, 13 Mar 2015 03:30:25 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/uil/wiki/Tutorial/feed" rel="self" type="application/rss+xml"/><item><title>Tutorial modified by David Mott</title><link>https://sourceforge.net/p/uil/wiki/Tutorial/</link><description>&lt;div class="markdown_content"&gt;&lt;div class="toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#creating-a-basic-form"&gt;Creating a basic form&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#creating-a-more-advanced-form"&gt;Creating a more advanced form&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#step-1-create-a-form-subclass"&gt;Step 1 - Create a form subclass&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#step-2-add-control-members"&gt;Step 2 - Add control members&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#step-3-initialize-members"&gt;Step 3 - Initialize members&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#step-4-set-properties"&gt;Step 4 - Set properties&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#step-5-attach-event-handlers"&gt;Step 5 - Attach event handlers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;h1 id="creating-a-basic-form"&gt;Creating a basic form&lt;/h1&gt;
&lt;p&gt;This is the most basic example of a &lt;strong&gt;uil&lt;/strong&gt; app&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;
int WinMain(HINSTANCE, HINSTANCE, LPSTR, int){
    uil::Form oForm;
    oForm.Run();
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;img alt="basic form" src="https://sourceforge.net/p/uil/screenshot/tut1.png" /&gt;&lt;/p&gt;
&lt;h1 id="creating-a-more-advanced-form"&gt;Creating a more advanced form&lt;/h1&gt;
&lt;h2 id="step-1-create-a-form-subclass"&gt;Step 1 - Create a form subclass&lt;/h2&gt;
&lt;p&gt;&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;
struct MyForm : uil::Form{&lt;br /&gt;
    MyForm(){}&lt;br /&gt;
};&lt;br /&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id="step-2-add-control-members"&gt;Step 2 - Add control members&lt;/h2&gt;
&lt;p&gt;&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;
struct MyForm : uil::Form{&lt;br /&gt;
    MyForm(){}&lt;br /&gt;
    uil::Button oButton;&lt;br /&gt;
};&lt;br /&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id="step-3-initialize-members"&gt;Step 3 - Initialize members&lt;/h2&gt;
&lt;p&gt;Controls require a parent so the form is passed into the constructor.&lt;br /&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;
struct MyForm : uil::Form{&lt;br /&gt;
    MyForm() : oButton(this){}&lt;br /&gt;
    uil::Button oButton;&lt;br /&gt;
};&lt;br /&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id="step-4-set-properties"&gt;Step 4 - Set properties&lt;/h2&gt;
&lt;p&gt;&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;
struct MyForm : uil::Form{&lt;br /&gt;
    MyForm() : oButton(this){&lt;br /&gt;
        oButton.Text(_T("Click Me"));&lt;br /&gt;
        oButton.Move(50, 50, 100, 20);&lt;br /&gt;
    }&lt;br /&gt;
    uil::Button oButton;&lt;br /&gt;
};&lt;br /&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id="step-5-attach-event-handlers"&gt;Step 5 - Attach event handlers&lt;/h2&gt;
&lt;p&gt;Here a Lambda is connected to the button's click event that changes the button's text.&lt;br /&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;
struct MyForm : uil::Form{&lt;br /&gt;
    MyForm() : oButton(this){&lt;br /&gt;
        oButton.Text(_T("Click Me"));&lt;br /&gt;
        oButton.Move(50, 50, 100, 20);&lt;br /&gt;
        oButton.ClickEvent.Connect( &lt;span&gt;[ this ]&lt;/span&gt; ( ) { &lt;br /&gt;
            oButton.Text(_T("Clicked!")); &lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    uil::Button oButton;&lt;br /&gt;
};&lt;br /&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The app's WinMain has changed only slightly &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;
int __stdcall WinMain(HINSTANCE, HINSTANCE, LPSTR, int){
    MyForm oForm;
    oForm.Run();
    return 0;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;img alt="form2" src="https://sourceforge.net/p/uil/screenshot/tut2.png" /&gt;&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">David Mott</dc:creator><pubDate>Fri, 13 Mar 2015 03:30:25 -0000</pubDate><guid>https://sourceforge.netf3fbcc92860517e2119b2b1c8d2bfd5f11f01b06</guid></item></channel></rss>