|
|
Home » Developing U++ » U++ Developers corner » Proposed change to U++ to allow owning children.
Re: Proposed change to U++ to allow owning children. [message #31642 is a reply to message #31641] |
Fri, 18 March 2011 16:34   |
Lance
Messages: 656 Registered: March 2007
|
Contributor |
|
|
And a sample program using this newly added capability.
#include <CtrlLib/CtrlLib.h>
// http://java.sun.com/docs/books/tutorial/uiswing/start/swingTour.html
using namespace Upp;
struct MyButton : Moveable<MyButton>, Button
{
public:
// should always default to false to confirm with
// existing U++ users habit
//
MyButton(bool toBeOwned=false)
{
if(toBeOwned)
Owned();
}
virtual ~MyButton()
{
String msg=String().Cat()<<"From within MyButton's destructor, with label "<<GetLabel();
DUMP(msg);
}
};
struct ButtonApp : TopWindow {
int count;
MyButton button;
Label label;
void RefreshLabel()
{
label = Format("Number of button clicks %d", count);
}
void Click()
{
++count;
RefreshLabel();
}
typedef ButtonApp CLASSNAME;
ButtonApp()
{
count = 0;
//button=*new MyButton();
Button * p = new MyButton(true);
Button * p2 = new MyButton();
button <<= THISBACK(Click);
button.SetLabel("&I'm an Ultimate++ button!");
Add(button.VCenterPos(20).HCenterPos(200));
Add(label.BottomPos(0, 20).HCenterPos(200));
label.SetAlign(ALIGN_CENTER);
Sizeable().Zoomable();
RefreshLabel();
Add(p->SetLabel("&Another button").TopPosZ(10, 50).LeftPosZ(30, 200)); // becuase MyButton is contructed with proper flag
Add(p2->SetLabel("Heap Button 2").TopPosZ(10, 50).LeftPosZ(250,200).Owned());
}
};
GUI_APP_MAIN
{
ButtonApp().Run();
}
With output:
msg = From within MyButton's destructor, with label I'm an Ultimate++ button!
msg = From within MyButton's destructor, with label Another button
msg = From within MyButton's destructor, with label Heap Button 2
|
|
|
 |
|
Proposed change to U++ to allow owning children.
By: Lance on Wed, 16 March 2011 17:18
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: kohait00 on Wed, 16 March 2011 17:26
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 16 March 2011 17:29
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 16 March 2011 17:30
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 16 March 2011 17:39
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: kohait00 on Wed, 16 March 2011 18:01
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 16 March 2011 18:10
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 16 March 2011 18:29
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 16 March 2011 18:35
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 16 March 2011 18:43
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 16 March 2011 19:24
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Fri, 18 March 2011 02:13
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: kohait00 on Fri, 18 March 2011 11:01
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Fri, 18 March 2011 14:39
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Fri, 18 March 2011 15:21
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Fri, 18 March 2011 15:40
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Fri, 18 March 2011 16:22
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Fri, 18 March 2011 16:34
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: mirek on Fri, 18 March 2011 19:35
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: mirek on Fri, 18 March 2011 19:32
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Fri, 18 March 2011 23:02
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: mirek on Fri, 18 March 2011 23:18
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Fri, 18 March 2011 23:34
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: mirek on Fri, 18 March 2011 23:40
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Sat, 19 March 2011 00:02
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: mirek on Sat, 19 March 2011 00:37
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Sat, 19 March 2011 01:30
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Sat, 19 March 2011 01:35
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: mirek on Sat, 19 March 2011 10:59
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: kohait00 on Sun, 20 March 2011 10:32
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Sun, 20 March 2011 14:07
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Sun, 20 March 2011 14:11
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Sun, 20 March 2011 14:28
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: kohait00 on Fri, 25 March 2011 13:26
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Sun, 27 March 2011 15:33
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: kohait00 on Sun, 17 April 2011 17:25
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Tue, 19 April 2011 06:00
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: kohait00 on Tue, 19 April 2011 09:14
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Tue, 19 April 2011 14:09
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: kohait00 on Tue, 19 April 2011 18:05
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 20 April 2011 02:44
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: kohait00 on Wed, 20 April 2011 08:51
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 20 April 2011 19:24
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 20 April 2011 21:17
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 20 April 2011 21:23
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 20 April 2011 21:38
|
 |
|
Re: Proposed change to U++ to allow owning children.
By: kohait00 on Thu, 28 April 2011 16:32
|
 |
|
revised ownership change
By: kohait00 on Thu, 28 April 2011 18:28
|
 |
|
Re: revised ownership change
By: Lance on Thu, 28 April 2011 21:45
|
 |
|
Re: revised ownership change
By: kohait00 on Thu, 28 April 2011 21:57
|
 |
|
Re: revised ownership change
By: Lance on Thu, 28 April 2011 23:18
|
 |
|
Re: revised ownership change
By: Lance on Thu, 28 April 2011 23:31
|
 |
|
Re: revised ownership change
By: Lance on Thu, 28 April 2011 23:54
|
 |
|
Re: revised ownership change
|
 |
|
Re: revised ownership change
|
 |
|
Re: revised ownership change
|
 |
|
Re: revised ownership change
By: Lance on Mon, 06 June 2011 05:11
|
 |
|
Re: revised ownership change
By: Lance on Mon, 06 June 2011 05:05
|
Goto Forum:
Current Time: Sat Jul 05 18:33:05 CEST 2025
Total time taken to generate the page: 0.04192 seconds
|
|
|