Home » Community » Newbie corner » Column Visible / hidden (arrayCtrl)
Re: Column Visible / hidden (arrayCtrl) [message #55246 is a reply to message #55245] |
Thu, 22 October 2020 21:32   |
Oblivion
Messages: 1206 Registered: August 2007
|
Senior Contributor |
|
|
Hello BetoValle,
HeaderCtrl controls the tab/column visibility.
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
struct App : TopWindow {
ArrayCtrl list;
App()
{
Sizeable().Zoomable().CenterScreen().SetRect(0, 0, 640, 480);
Add(list.SizePos());
list.AddColumn("Column 1");
list.AddColumn("Column 2").HeaderTab().Hide(); // HeaderCtrl controls tab/column visibilty.
list.Add("Hello", "world!");
list.Add("Ultimate++", "rocks!");
list.WhenBar = [=](Bar& bar) { ColumnMenu(bar); };
list.ColumnWidths("100 200"); // Sets column widths...
}
void ColumnMenu(Bar& bar) // A context (right click) menu to set tab visibiliy
{
HeaderCtrl& header = list.HeaderObject();
for(int i = 0; i < header.GetCount(); i++){
bool visible = header.IsTabVisible(i);
auto label = header[i].GetText();
bar.Add(label, [=] { list.HeaderObject().ShowTab(i, !visible); }).Check(visible);
}
}
};
GUI_APP_MAIN
{
App().Run();
}
You can use HeaderCtrl::SetTabWidth() method to set the width at any time.
Best regatrds,
Oblivion
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Thu, 22 October 2020 21:49] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun May 11 06:59:12 CEST 2025
Total time taken to generate the page: 0.00544 seconds
|