Home » Community » Newbie corner » menu Tree
Re: menu Tree [message #32412 is a reply to message #32410] |
Tue, 17 May 2011 04:42   |
Sender Ghost
Messages: 301 Registered: November 2008
|
Senior Member |
|
|
nlneilson wrote on Tue, 17 May 2011 03:51 |
This I don't understand.
"... without using MenuBar" --- "And using "MenuBar ..."
|
Just read full context. In simplified form it looks like follows:
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
class Window : public TopWindow {
public:
typedef Window CLASSNAME;
Window();
ArrayCtrl list;
};
Window::Window()
{
Title("New Window");
SetRect(Size(320, 240));
list.HSizePosZ(4, 4).VSizePosZ(4, 4);
list.AddColumn(String());
for (int i = 0; i < 10; ++i)
{
list.Add(AsString(i + 1));
}
Add(list);
}
class App : public TopWindow {
public:
typedef App CLASSNAME;
App();
MenuBar menu;
Window window;
void MainBar(Bar& bar);
void FileBar(Bar& bar);
void OnSettings();
};
App::App()
{
Title("MenuBar test application");
SetRect(Size(640, 480));
AddFrame(menu);
AddFrame(TopSeparatorFrame());
menu.Set(THISBACK(MainBar));
}
void App::MainBar(Bar& bar)
{
bar.Add("File", THISBACK(FileBar));
}
void App::FileBar(Bar& bar)
{
bar.Add("Settings", THISBACK(OnSettings));
bar.Separator();
bar.Add("Exit", THISBACK(Close));
}
void App::OnSettings()
{
window.Execute();
}
GUI_APP_MAIN
{
App app;
app.Run();
}
I guess, this is not what you looking for, but it was that I suggested.
You can continue to find exact solution, of course. E.g. trying to extend MenuBar to support Option with right check (>), which shows next menu bar, after mouseover on it (mimic MenuItem).
// Somewhere inside derived TopWindow class
Option opt;
// Then add it for some Bar
bar.AddNC(opt);
Or using different solutions, not mentioned here.
|
|
|
Goto Forum:
Current Time: Sat Jun 07 13:11:40 CEST 2025
Total time taken to generate the page: 0.04271 seconds
|