Home » Community » Newbie corner » menu Tree
Re: menu Tree [message #32379 is a reply to message #32378] |
Sat, 14 May 2011 14:57 |
Sender Ghost
Messages: 301 Registered: November 2008
|
Senior Member |
|
|
nlneilson wrote on Sat, 14 May 2011 10:41 |
Just informative lines of text with no action, THISBACK, or Callback.
|
Hello, Neil.
You can add Ctrl(s) to Bar with using Add(Ctrl& ctrl) or AddNC(Ctrl& ctrl) functions. For "informative" text, you can use Label Ctrl, for example:
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
class App : public TopWindow {
public:
typedef App CLASSNAME;
App();
MenuBar menu;
Label label;
void MainBar(Bar& bar);
void FileBar(Bar& bar);
};
App::App()
{
Title("MenuBar test application");
CenterScreen().Sizeable().MinimizeBox().MaximizeBox();
SetRect(Size(320, 240));
AddFrame(menu);
AddFrame(TopSeparatorFrame());
menu.Set(THISBACK(MainBar));
label.SetLabel("Some informative text");
}
void App::MainBar(Bar& bar)
{
bar.Add("File", THISBACK(FileBar));
}
void App::FileBar(Bar& bar)
{
bar.AddNC(label);
bar.Separator();
bar.Add("Exit", THISBACK(Close)).Key(K_CTRL_Q);
}
GUI_APP_MAIN
{
App app;
app.Run();
}
[Updated on: Sat, 14 May 2011 15:18] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun May 05 21:40:48 CEST 2024
Total time taken to generate the page: 0.02507 seconds
|