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++ Library support » U++ Widgets - General questions or Mixed problems » Where to add event function in theide
Re: Where to add event function in theide [message #21486 is a reply to message #21485] Fri, 22 May 2009 15:29 Go to previous messageGo to previous message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
By using the Layout editor you create just a template, a recipe if you will, for creating a window or a widget that will have that layout and those fields. It is a definition, speaking in C terms. You need a declaration.

Let’s say you named your template TestLayout. Now you can create a concrete layout by appending "With" to the name of the template:
class testWindows: WithTestLayout<TopWindow>


Now you have a class with that layout and it will contain your "btnOK". Yet you can search in the code and you won’t find that explicit declaration anywhere.

In one of your methods from the class, usually the constructor, you can say:
btnOK=callback(btnOKClick);


Or if you want to use a less OOP approach, you can do:
WithTestLayout<StaticRect> b;
b.btnOk=callback...

Notice this time I used StaticRect. You can apply the layout to anything you want, including Buttons, EditFields and every existing widget, including your own if you have written any custom widgets.

PS: Don't forget to call CtrlLayout. Without it you layout will appear null.
I hope you’ll have more success with layouts in the future. Very powerful once you get used to them.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: ASSERT(IsMainThread());
Next Topic: Menus on dual monitors (Windows)
Goto Forum:
  


Current Time: Thu May 09 04:37:32 CEST 2024

Total time taken to generate the page: 0.02056 seconds