Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
Oblivion is currently offline  Oblivion
Messages: 1094
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


[Updated on: Thu, 22 October 2020 21:49]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: "simple" connection and operation with database
Next Topic: RegisterSystemHotKey not work here
Goto Forum:
  


Current Time: Sat Jun 08 04:09:59 CEST 2024

Total time taken to generate the page: 0.02436 seconds