How to install Ultimate++ And Make A Program From U++
Hello Guys!😎 welcome back on my blog!🐆. Today i want to tell you how to install Ultimate++ in GUI and make a button and count the click with GUI. Same like before... first let me tell you the definition of GUI.GUI
GUI (Graphical User Interface) is a graphical display that
contains the tools or components that enable users to perform interactive work. GUI created for the user to interact with the
computer hardware and ease of operating a system (user
friendly).
okey,now let's start install the Ultimate++ 😎
How To Install Ultimate++
Now, go to http://ultimatepp.org/
and click download the ultimate++.
Then, select your OS if you use Microsoft Windows you can
click download on the MS Windows Platform.
Then, select the lastest update from U++
After that choose u++ with mingw compiler and download it!
After the download is clear extract the file to the directory that
you want to extract there.
After that go to My Computer(Right click)>select properties>
Advanced System Setting>Enviroment Variables.
Find path, add
the paths to the executables for U++ bin directories, click new to make a new enviroment variables example "C:\upp\bin\". If you still confuse look at the picture,Click
"OK" after you finish it. But if you using windows 8.1 and below version you must insert semicolon at the and of directory example "C:\upp\bin\;".
Now you can use your ultimate++ open the u++ directory and run "theide.exe".
Make a Button to Count a Click
First, open the ide.exe go to the my apps and click new package.
After that select Basic CtrLib application to make a program from U++ library
don't forget to fill your package name.
Now we coding the code now!
first call the library and delcare the program "using namespace Upp;" don't forget to build a windows frame with "TopWindow" and declare the variabel.#include <CtrlLib/CtrlLib.h>using namespace Upp;struct ButtonApp : TopWindow {int count;Button button;Label label;
Then, we make a void RefreshLabel to format the label for count.void RefreshLabel(){label = Format("Number of button clicks %d", count);}
After that, we make a void for click command, if we click the button it will be count the button and refresh the label.void Click(){++count;RefreshLabel();}
typedef ButtonApp CLASSNAME;
Next, we declare Button app into the classname.
Next, i will make the program for the button. make the count count from zero, we set the button reset after we click using "button <<= THISBACK(Click);" and set label(text) in the button.ButtonApp(){count = 0;button <<= THISBACK(Click);button.SetLabel("&Test!");Add(button.VCenterPos(20).HCenterPos(200));Add(label.BottomPos(0, 20).HCenterPos(200));label.SetAlign(ALIGN_CENTER);Sizeable().Zoomable();RefreshLabel();}};
then we ad the square for the button with "Add(button.VCenterPos(20).HCenterPos(200));" and "Add(label.BottomPos(0, 20).HCenterPos(200));" then make the label(text) to the Align Center.
The last make GUI APP MAIN to Run and button up the program.GUI_APP_MAIN{ButtonApp().Run();}
this is the full code
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
struct ButtonApp : TopWindow {
int count;
Button button;
Label label;
void RefreshLabel()
{
label = Format("Number of button clicks %d", count);
}
void Click()
{
++count;
RefreshLabel();
}
typedef ButtonApp CLASSNAME;
ButtonApp()
{
count = 0;
button <<= THISBACK(Click);
button.SetLabel("&Test!");
Add(button.VCenterPos(20).HCenterPos(200));
Add(label.BottomPos(0, 20).HCenterPos(200));
label.SetAlign(ALIGN_CENTER);
Sizeable().Zoomable();
RefreshLabel();
}
};
GUI_APP_MAIN
{
ButtonApp().Run();
}
Don't forget if you want to execute the program use the MingW debug and select to the GUI.
This is the result:
Comments
Post a Comment