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)
Column Visible / hidden (arrayCtrl) [message #55239] Wed, 21 October 2020 20:24 Go to next message
BetoValle is currently offline  BetoValle
Messages: 203
Registered: September 2020
Location: Brasil Valinhos SP
Experienced Member
Hi,

how to make column invisible/hidden?
Re: Column Visible / hidden (arrayCtrl) [message #55245 is a reply to message #55239] Thu, 22 October 2020 20:48 Go to previous messageGo to next message
BetoValle is currently offline  BetoValle
Messages: 203
Registered: September 2020
Location: Brasil Valinhos SP
Experienced Member
this question is also a real one:

How do I change the width of a grid column after the grid is loaded on the screen?

Please! Thanks!
Re: Column Visible / hidden (arrayCtrl) [message #55246 is a reply to message #55245] Thu, 22 October 2020 21:32 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1096
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

Re: Column Visible / hidden (arrayCtrl) [message #55247 is a reply to message #55246] Thu, 22 October 2020 21:52 Go to previous message
BetoValle is currently offline  BetoValle
Messages: 203
Registered: September 2020
Location: Brasil Valinhos SP
Experienced Member
TankYou!

... I was already speculating on a rudimentary solution:

HWld::HWld() //constructor
{ CtrlLayout(*this, "Titulo da janela");
grid.AddColumn("primeira",15);
grid.AddColumn("segunda",25);
grid.AddColumn("terceira",25);
grid.AddColumn("quarta",35);

grid.Add("1","","","");
grid.Add("2","","","");
grid.Add("3","","","");
........................
void HWld::Click(){//redoing / changing number of columns / hides the 1st and 4th column
grid.Reset();
grid.AddColumn("segunda",50);
grid.AddColumn("terceira",50);
grid.Add("1","");
grid.Add("2","");
grid.Add("3","");
return;
......
Previous Topic: "simple" connection and operation with database
Next Topic: RegisterSystemHotKey not work here
Goto Forum:
  


Current Time: Fri Jun 21 01:00:08 CEST 2024

Total time taken to generate the page: 0.02112 seconds