Click here to Skip to main content
Click here to Skip to main content

Getting Started With Ultimate++

, 6 Nov 2006
Rate this:
Please Sign up or sign in to vote.
A beginner's tutorial: Using Ultimate++ to quickly create cross-platform GUI applications.

Introduction

When it comes to creating applications, a number of solutions exist- each with advantages and disadvantages. Cross-platform toolkits have become popular due to their ease of use and portability. The purpose of this tutorial is to show how easy it is to create applications with the Ultimate++ toolkit. We will be making a simple shopping list.

What is Ultimate++?

  1. A cross-platform graphical widget toolkit for the rapid development of GUI programs.
  2. A set of C++ (and U++) libraries (called packages in Ultimate++):
    • "Core" is the base for all other Ultimate++ libraries.
    • "CtrlCore" - a base for widgets (or controls).
    • "CtrlLib" - actual widgets (or controls).
    • Other libraries.
  3. An IDE called TheIDE.
Ultimate++ puts the focus on the programmer, making it as easy as possible to create GUI applications.

Why use Ultimate++?

  • It is simple, mature, and powerful.
  • It is free and open source software, released under a mostly BSD license.
  • It is being actively developed. Questions are promptly answered on the site's forums.
  • It runs (and creates applications that run) on Windows, Linux, and FreeBSD. WinCE and MacOS support is planned.
  • Code is portable from one platform to the next.
  • Many advanced features are built-in (SQL, XML, etc.).

Installing Ultimate++

Installation is very simple:

  • Download the latest version of the toolkit (Ultimate++ 605 with MinGW) from SourceForge.
  • Double click the file you just downloaded to begin installation. Leave the install path C:\upp and click install.
  • Read and accept the license agreement, then read the information about compilers. For this tutorial, we will just use the included MinGW.
  • Choose your application directory. It's fine to leave it as C:\MyApps.
  • The default settings should be sufficient. Click OK.
That's it! Wasn't that easy?

Creating A New Project

When you launch TheIDE, you will be prompted by the "Select main package" dialog. Assemblies group projects together- after you finish this tutorial you should look through all the examples and reference applications provided. They have a wealth of information. You want to select the MyApps assembly and click the "New Package" button.

Select Main Package

Choose a name for your application. We will use SimpleDemo. Then select the template "CtrlLib application with main window".

Create New Package

Click the "Create" button at the bottom. TheIDE's main interface will now open. Two important sections exist at the top left of the screen:

IDE Files

  1. These are the Ultimate++ packages that are needed to compile your program.
  2. These are you package's files. The ones there now were created automatically.
Let's take a look at the code that was created automatically for you:

SimpleDemo.h
#ifndef _SimpleDemo_SimpleDemo_h
#define _SimpleDemo_SimpleDemo_h

#include <CtrlLib/CtrlLib.h>

#define LAYOUTFILE <SimpleDemo/SimpleDemo.lay>
#include <CtrlCore/lay.h>

class SimpleDemo : public WithSimpleDemoLayout<TopWindow> {
public:
    typedef SimpleDemo CLASSNAME;
    SimpleDemo();
};

#endif
main.cpp
#include "SimpleDemo.h"

SimpleDemo::SimpleDemo()
{
    CtrlLayout(*this, "Window title");
}

GUI_APP_MAIN
{
    SimpleDemo().Run();
}
SimpleDemo.lay
This is a layout file- it allows us to visually place widgets into our program. Clicking the filename opens the Layout Designer on the right.

Trying it Out

First Build Screenshot

Believe it or not, we already have a working application! It doesn't do much anything yet, but notice how Ultimate++ has taken care of all the tedious Windows API stuff for us. Want to try it out? Just press Ctrl-F5. (You can also click the Debug menu and select Execute). This will build the application (with debugging info) and run it.

We have a plain window with a default title. We will need to change that. We also have a close button in the corner- we probably want to add minimize and maximize buttons. Notice that the window is not resizeable.

Note: The first build is always the slowest. The Ultimate++ library must be compiled on the first run, but it is cached for later runs. TheIDE uses Blitz technology to speed up compiles on subsequent runs. (Try it! Make a trivial change-like adding a newline to main.cpp. Press Ctrl-F5 again and see how much fater it compiles.) Users have also reported that using Microsoft's Visual C++ Express compiler is faster and creates a smaller executable.

Making Our Application

We are going to make a simple shopping list application.

Setting Up the Layout

Click on the file SimpleDemo.lay to open the layout designer. Drag the corner of the box to make our layout a bit larger. You can right-click within the layout to add new widgets.
Add a static text widget. We will use this as a heading for our application. Notice the properties that appear to the left of the layout area.

Layout Designer Properties

Set a name for the widget. It is helpful to use prefixes to distinguish what the widget is- I chose txtTitle. Set the text to "Shopping List", center the text, and set the font to 20pt. Create the following widgets:

  • Label lblItem with label "Item"
  • EditString strItem
  • Button btnAdd with label "Add"
  • ArrayCtrl arrList

Arrange the widgets so it looks like the following picture:

The Final Layout

Try compiling it again (Ctrl-F5). Our program is starting to shape up.

Making it Do Something

Let's add some functionality. We need to write a function that adds an item to our list when we push the button. Add the following to the class definition in SimpleDemo.h:

    void AddItem();

Now we need to implement this. Go to main.cpp and begin typing:

    void SimpleDemo::

Notice a box pops up with code suggestions. This feature is called Assist++, and it can be accessed anytime by pressing Ctrl-Space.

Assist++

Write the rest of the AddItem() function:

void SimpleDemo::AddItem()
{
    // The ~ operator calls the object's GetData() function
    arrList.Add(~strItem);
    strItem <<= Null;    // Manually clear the item
}

Let's give the list a column title and connect the button to our new function. Add this to SimpleDemo::SimpleDemo():

    arrList.AddColumn("Item");    // Add a column titled "Item"
    arrList.Removing();        // Gives us a right-click menu to delete rows
    btnAdd <<= THISBACK(AddItem);
   // Uses a callback to link the button to the function

Compile again (Ctrl-F5) to see the results.

Making it do just a little more

Right now our application does everything we need it to- simply keep up with items for a shopping list. But to show how easy certain things are in Ultimate++, let's go a little farther.
Change the window title by modifying the first line in SimpleDemo::SimpleDemo():

    CtrlLayout(*this, "Shopping List");

Add the following line right after the previous line:

    Sizeable().Zoomable();

That adds minimize and maximize buttons to the title bar as well as allow you to resize the window.

Final Code

SimpleDemo.h:

#ifndef _SimpleDemo_SimpleDemo_h
#define _SimpleDemo_SimpleDemo_h

#include <CtrlLib/CtrlLib.h>

#define LAYOUTFILE <SimpleDemo/SimpleDemo.lay>
#include <CtrlCore/lay.h>

class SimpleDemo : public WithSimpleDemoLayout<TopWindow> {
    void AddItem();
public:
    typedef SimpleDemo CLASSNAME;
    SimpleDemo();
};

#endif

main.cpp:

#include "SimpleDemo.h"

SimpleDemo::SimpleDemo()
{
    CtrlLayout(*this, "Shopping List");
    Sizeable().Zoomable();
    arrList.AddColumn("Item");    // Add a column titled "Item"
    arrList.Removing();  // Gives us a right-click menu to delete rows
    btnAdd <<= THISBACK(AddItem);
    // Uses a callback to link the button to the function
}

void SimpleDemo::AddItem()
{
    // The ~ operator calls the object's GetData() function
    arrList.Add(~strItem);
    strItem <<= Null;        // Manually clear the item
}

GUI_APP_MAIN
{
    SimpleDemo().Run();
}

Here is our application in action:

Final Product

Conclusion

There you have it! A very simple application made in just minutes, thanks to the power and simplicity of Ultimate++. Please note that you could then take this code over to Linux and compile it for X11. It just works. One of Ultimate++'s strengths is that it is self-contained. There is no need to find a separate IDE, a separate layout designer, or a separate compiler. It's all built-in (or bundled). I urge you to look at the example applications that are already installed to see how easy Ultimate++ is to learn.

Helpful links

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Matt Ezell

United States United States
Matt Ezell is a student at the University of Tennessee, USA. He has been programming in C++ for a couple years, and he now uses Ultimate++ for his applications. Visit his website at Ezell Media.

Comments and Discussions

 
GeneralRe: Great article! Pinmemberluzr24-Sep-06 21:57 
GeneralGreat job! [modified] PinmemberRonnie IJsbrandij26-Aug-06 13:23 
GeneralNot very conviced Pinmemberemilio_grv15-Aug-06 6:11 
GeneralRe: Not very conviced Pinmemberluzr15-Aug-06 9:01 
GeneralRe: Not very conviced Pinmemberemilio_grv16-Aug-06 4:17 
GeneralRe: Not very conviced Pinmemberluzr16-Aug-06 4:30 
GeneralRe: Not very conviced Pinmemberarilect19-Aug-06 12:19 
GeneralRe: Not very conviced Pinmemberhongdong21-Aug-06 15:44 
QuestionIs it better that Smartwin++ or WTL? Pinmemberyarus2415-Aug-06 3:16 
AnswerRe: Is it better that Smartwin++ or WTL? Pinmemberluzr15-Aug-06 9:36 
GeneralRe: Is it better that Smartwin++ or WTL? Pinmemberyarus2415-Aug-06 10:19 
GeneralRe: Is it better that Smartwin++ or WTL? Pinmemberluzr15-Aug-06 10:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141216.1 | Last Updated 6 Nov 2006
Article Copyright 2006 by Matt Ezell
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid