Home » U++ TheIDE » U++ TheIDE: Layout (Forms) Designer » Programming for Layout Objects
Re: Programming for Layout Objects [message #1866 is a reply to message #1862] |
Fri, 24 March 2006 09:45 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
InterKnight wrote on Thu, 23 March 2006 22:22 | Hello, everyone.
I've been working with U++ for just a day or so now, and I am finally on the way to creating an application for an old friend. I previously didn't think I would get this far with GUI design, but I am glad to see that I was wrong.
My question pertains to objects which can be added to the Layout GUI Editor (for example: buttons, labels, etc).
What I need to know is how to program events for buttons. A simple example would be: How would I program the "Cancel" button so that it exits the program?
I've learned how to create menus for applications (with File, View, Help, etc), but I am not yet sure exactly how to implement options.
So, just for simplicity sake, how would I add in code to tell the program that the "Cancel" button exits the program?
Thanks greatly for any help/suggestions.
Take care.
|
There are some very simple basic things about widgets:
If you have widget "foo": (e.g. EditField foo;)
* to assign it a value, use
foo <<= value;
* to retrieve its value, use
value = ~foo;
* to add default event, which is invoked when user changes the state of widget:
foo = callback(...)
Now those "callback(...)" can vary depending on event, however in the most common case, you will have your widget inside some dialog object class and then it will look like:
struct Dialog {
Button cancel;
void Cancel();
typedef Dialog CLASSNAME;
Dialog() {
cancel <<= THISBACK(Cancel);
}
};
Note that as of U++ 602, there is Assist++ THISBACKs... and Layout code generator.. functions that can help you to generate some of that code...
Mirek
|
|
|
Goto Forum:
Current Time: Sun May 05 02:19:01 CEST 2024
Total time taken to generate the page: 0.02863 seconds
|