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 » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » Multiline popups in GridCtrl
Re: Multiline popups in GridCtrl [message #23776 is a reply to message #23754] Fri, 20 November 2009 15:59 Go to previous messageGo to previous message
Zbych is currently offline  Zbych
Messages: 327
Registered: July 2009
Senior Member
Another problem. In my application I use WhenCursor callback to enable/disable ToolBar. Inside this callback I check if any row is selected by calling IsCursor. The problem is that IsCursor gives incorrect state of cursor at that time (probably WhenCursor callback is executed to early in GridCtrl::SetCursor0).

Steps:
1. click add
2. click on some row - tool bar should be enabled (but it is not)
3. click second time - now tool bar is enabled.
4. click clear - now grid is empty, but callback is not executed (in my opinion should be, because cursor is gone) and tool bar is not deactivated.

Test code:
struct App : public TopWindow
{
	typedef App CLASSNAME;
	Button ok;
	Button clear;
	ToolBar tool;
	GridCtrl grid;
	
	void AddToGrid();
	void ClearGrid();
	void MyToolBar(Bar& bar);

	void ToolBarRefresh();
	App();	
	
};

App::App()
{
		Sizeable();
		grid.HSizePosZ(10,10);
		tool.Set(THISBACK(MyToolBar));
		
		AddFrame(tool);
        Add(grid.SizePos().HSizePos(0,0).VSizePosZ(0,50));
        grid.AddColumn( "Name").DoSum("%d");
        grid.AddColumn( "Surname").DoSum("%d");
		grid.WhenCursor = THISBACK(ToolBarRefresh);
		
		ok.WhenPush = THISBACK(AddToGrid);
		clear.WhenPush = THISBACK(ClearGrid);  
		ok.SetLabel(t_("Add")).HCenterPosZ(76, -84).BottomPosZ(8, 32);
		clear.SetLabel(t_("Clear")).HCenterPosZ(76, 80).BottomPosZ(8, 32);
		Add(ok);
		Add(clear);		
}

void App::AddToGrid(){
	for(int l=0; l<5; l++){
		grid.Add(l, Format("Row %d\nRow %d\nRow %d\n", l,l,l));	
	}
}

void App::ClearGrid()
{
	grid.Clear();
}

void App::MyToolBar(Bar& bar)
{
	bar.Add(grid.IsCursor(), "File", Image::Wait() , THISBACK(ClearGrid));
	bar.Add(grid.IsCursor(), "File", Image::Wait() , THISBACK(ClearGrid));
}

void App::ToolBarRefresh()
{
	tool.Set(THISBACK(MyToolBar));
	Beep(1000,100);
}

GUI_APP_MAIN
{
	App app;
	app.Run();
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IsMultiSelect() bugfix in ArrayCtrl
Next Topic: Paste column in GridCtrl
Goto Forum:
  


Current Time: Wed Aug 27 14:33:56 CEST 2025

Total time taken to generate the page: 0.07421 seconds