Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: Layout (Forms) Designer » Programming for Layout Objects
Re: Programming for Layout Objects [message #2036 is a reply to message #1866] Thu, 30 March 2006 13:10 Go to previous messageGo to previous message
gprentice is currently offline  gprentice
Messages: 260
Registered: November 2005
Location: New Zealand
Experienced Member
luzr wrote on Fri, 24 March 2006 20:45

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



Mirek - you have written above that <<= is used to assign foo a value - but the Button widget uses <<= to assign a callback.

On the "whetting your appetite" web page you have this
Days::Days()
{
CtrlLayout(*this, "Days");
date1 <<= THISBACK(Compute);
date2 <<= THISBACK(Compute);
}

where date1 is an EditDate.

How do you find out which operators do what for a widget.
e.g. where is the <<= operator for an EditDate declared.

Graeme








 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: "Edit using designer" from cpp file- nothing happens? [BUG]
Next Topic: Positioning in Designer
Goto Forum:
  


Current Time: Sun May 05 07:06:51 CEST 2024

Total time taken to generate the page: 0.04412 seconds