Home » Community » Newbie corner » Question on a widget on top of a widget **BUG STATEMENTS NOT COMPLETED BEFORE NEXT STATEMENT
Re: Question on a widget on top of a widget [message #33287 is a reply to message #33281] |
Fri, 22 July 2011 16:16 |
|
Hi silverx,
If I understand correctly, you wan't to do something like this:#include <CtrlLib/CtrlLib.h>
using namespace Upp;
class App:public TopWindow {
typedef App CLASSNAME;
Button b;
EditString e;
public:
App(){
b.SetLabel("Click me!"); //set the button text
Add(b.HCenterPos(100).VCenterPosZ(30)); //add button to the window
b.Add(e.HCenterPos(80).VCenterPos(20)); //add editfield to the button,
//positioning is relative to the button
b<<=THISBACK(SwitchEdit); // assign function to the button click
e.Hide(); // hide the editfield initialy
}
void SwitchEdit(){
e.Show(!e.IsShown()); // switch the visibility
}
};
GUI_APP_MAIN{
App().Sizeable().Run();
}
As you can see, you can just easily Add a Ctrl into any other Ctrl. Simple solutions are often the best
Best regards,
Honza
PS: Forgot to mention that if you're using layouts, you can use the button from layout, but the "second layer" ctrl must be added in code. (Well, actually you COULD, but it is bit more complicated and seldom necessary...). Also, you can add more than one widget or even entire layout.
[Updated on: Fri, 22 July 2011 16:21] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Thu May 23 03:58:48 CEST 2024
Total time taken to generate the page: 0.01543 seconds
|