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 #21478 is a reply to message #21473] |
Fri, 22 May 2009 10:26 |
|
mirek
Messages: 13976 Registered: November 2005
|
Ultimate Member |
|
|
samsam598 wrote on Thu, 21 May 2009 21:22 | Thanks so much for your help.I mean,for example,when one clicks a button named btnOK,something happens:
void btnOK_Click()
{
PromptOK("Button btnOK is clicked.");
}
In the ide,when I create a form with a button,I can not find out where to add the above code.
ALT+T or Assist(ALT+C) all tried but it does not help.
Regards,
Sam
|
I see.
First of all, do you already have dialog class?
http://www.ultimatepp.org/reference$Layout.html
(beware, above example shows how to create your dialog class, not your case).
Anyway, as long as you have such class, simply put
myOKbutton = callback(btnOK_Click);
into constructor.
Note that in 99.99% cases, you will rather want to call a method of dialog, not global level function. That is what Alt+T is designed for. Also, as soon as you type THISBACK(, Assist++ will offer a list of methods...
Another relevant example:
http://www.ultimatepp.org/examples$Button.html
Just in this case, no layout is used. Anyway, using designed layout has very similar effect to adding "button" member variable and "Add(button.VCenterPos(20).HCenterPos(200));"...
Mirek
|
|
|
Goto Forum:
Current Time: Thu May 09 19:40:53 CEST 2024
Total time taken to generate the page: 0.01407 seconds
|