Today's Smalltalk 4 You continues the brief tutorial on WindowBuilder Pro, by hooking up a domain object to the UI we painted last time. If you have trouble viewing it here in the browser, you can also navigate directly to YouTube. To watch now, click on the image below:

If you have trouble viewing that directly, you can click here to download the video directly. If you need the video in a Windows Media format, then download that here.

You can also watch it on YouTube:

Today we'll continue our introduction to WindowBuilder pro in VA Smalltalk. Last time we painted the UI - today, we'll hook the UI we painted up to the simple Counter application we built awhile ago.

To refresh a bit, here's the simple UI we built - an input field for the current value, and a button to increment the value:

One thing we didn't do is hook the button up to any behavior. To do that, we need to define a callback - a SMalltalk method that will be invoked when the button is pressed:

You can doa number of things in the callback definition UI, but we're going to take the simplest tack: hook up a callback for when the button is pressed:

Go back to the browser and look at the code that got generated again - you should notice a new section for the callback:

Now we'll getinto hooking the UI up to a domain object. We'll define an instance variable in the UI to hold the domain object, and instantiate it in the initialize method:

Next, we'll set up the callback method to use the domain object when the button is pressed. To update the input field, we need to grab it by name using #widgetNamed:, and then use the #value: message to set the value into it:

Finally, we can test the UI. Open it up and you should see the input field incrementing when you press the button:

That's it - we've created a simple UI that hooks up to a domain object, and updates the state of the domain based on UI actions. With that, you should be able to get started building more useful things with WindowBuilder Pro!