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 » GridCtrl samples with all functions and methods
icon5.gif  GridCtrl samples with all functions and methods [message #25531] Sun, 28 February 2010 05:12 Go to next message
bernz is currently offline  bernz
Messages: 4
Registered: February 2010
Location: Philippines
Junior Member
Hi,,

I really liked the GridCtrl..kudos to your work Surprised !

I would like to explore it, however..it lacks documentation Rolling Eyes , can you provide one or better yet a working sample app Smile


Thanks and regards,
bernz Very Happy
Re: GridCtrl samples with all functions and methods [message #26012 is a reply to message #25531] Thu, 25 March 2010 21:40 Go to previous messageGo to next message
Ficko is currently offline  Ficko
Messages: 3
Registered: March 2010
Junior Member
Yep it would be nice.

I am using U++ for 2 days right now and got 10 years older already Very Happy not being able to get even some basic examples in the “help” to work.

Like

Quote:


'WhenRowChange' : is not a member of 'Upp::GridCtrl'



or

Quote:


grid.AddColumn("Name").Edit(name);
grid.AddColumn("Age").Edit(age);



Definitely doesn’t work.

Any input would be heavily appreciated. Razz
Re: GridCtrl samples with all functions and methods [message #26015 is a reply to message #26012] Thu, 25 March 2010 22:40 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1354
Registered: November 2005
Location: Poland
Senior Contributor

Could you attach a full test case? It looks like grid variable is not GridCtrl type. All you need is:
#include <GridCtrl/GridCtrl.h>
using namespace Upp;
GridCtrl grid;



[Updated on: Thu, 25 March 2010 22:41]

Report message to a moderator

Re: GridCtrl samples with all functions and methods [message #26018 is a reply to message #26015] Fri, 26 March 2010 10:21 Go to previous messageGo to next message
Ficko is currently offline  Ficko
Messages: 3
Registered: March 2010
Junior Member
Oh I just practically "copy-paste" the samples from
"Used packages/GridCtrl/Tutorial" Embarassed

I am not saying that anything is wrong with the package only that it is useless for a novice like me without a good manual. Confused

Here is the test case I tried to tinker following the "Tutorial".

Quote:


#include <GridCtrl/GridCtrl.h>

using namespace Upp;

struct App : TopWindow
{
typedef App CLASSNAME;

GridCtrl grid;

App()
{
EditString name;
EditInt age;
Add(grid.SizePos());
grid.AddColumn("Name").Edit(name); //This dosn't work
grid.AddColumn("Age").Edit(age);//Or I am missing a callback not explained in help
grid.Add("Ann", 21)
.Add("Jack", 34)
.Add("David", 15);
//grid.WhenLeftDouble = THISBACK(ShowInfo); //This works
//grid.WhenRowChange = THISBACK(RandomColor); //This dosn't compile
}
void ShowInfo()
{
PromptOK(Format("%s is %d years old", grid(0), grid(1)));
}
void RandomColor()
{
grid.GetRow().Bg(Color(rand() % 255, rand() % 255, rand() % 255));
}
};


GUI_APP_MAIN
{
App().Run();
}

Re: GridCtrl samples with all functions and methods [message #26019 is a reply to message #26018] Fri, 26 March 2010 11:05 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 2987
Registered: August 2008
Veteran
Hello Ficko

This will work.

I have just moved EditString name; and EditInt age; out of App() and added grid.Editing().Appending().AskRemove().Canceling().Duplicati ng().Clipboard().ColorRows(); . You will not need it all but it is just a sample. Try to click with right button Smile

Hope this helps.

#include <GridCtrl/GridCtrl.h>

using namespace Upp;

struct App : TopWindow
{
	typedef App CLASSNAME;
	
	GridCtrl grid;
	
	EditString name; // Out of App() so they are always available
	EditInt age;
			
	App()
	{
		Add(grid.SizePos());
		grid.AddColumn("Name").Edit(name); //This dosn't work
		grid.AddColumn("Age").Edit(age);//Or I am missing a callback not explained in help
		grid.Add("Ann", 21)
		.Add("Jack", 34)
		.Add("David", 15);
		grid.Editing().Appending().AskRemove().Canceling().Duplicating().Clipboard().ColorRows();   // With this you can edit, append, ...
		grid.WhenLeftDouble = THISBACK(ShowInfo); //This works
		//grid.WhenRowChange = THISBACK(RandomColor); //This dosn't compile
	}
	void ShowInfo()
	{
		PromptOK(Format("%s is %d years old", grid(0), grid(1)));
	}
	void RandomColor()
	{
		grid.GetRow().Bg(Color(rand() % 255, rand() % 255, rand() % 255));
	}
};


GUI_APP_MAIN
{
	App().Run();
}


Best regards
Iñaki
Re: GridCtrl samples with all functions and methods [message #26027 is a reply to message #25531] Fri, 26 March 2010 15:34 Go to previous messageGo to next message
Ficko is currently offline  Ficko
Messages: 3
Registered: March 2010
Junior Member
Thanks Koldo,

realy appreciate your help. Smile

Now I have something runnig as starting point!

Just curious what is wrong with "grid.WhenRowChange" ?

Do this member got canceled ? Rolling Eyes

One other thing.

The manual says:

Quote:


1) Not fully implemented in current version, only resizing of rows. Column resizing will be available in full 1.0 version.



Do this main the U++ version or do the GridCtrl has his own versioning ?

[Updated on: Fri, 26 March 2010 15:35]

Report message to a moderator

Re: GridCtrl samples with all functions and methods [message #26043 is a reply to message #26027] Fri, 26 March 2010 19:53 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 2987
Registered: August 2008
Veteran
Hello Ficko

I am not a GridCtrl expert. However WhenChangeRow exists now.

Perhaps the projected name was WhenRowChange and finally it was changed.


Best regards
Iñaki
Re: GridCtrl samples with all functions and methods [message #26809 is a reply to message #25531] Sun, 30 May 2010 18:06 Go to previous messageGo to next message
bernz is currently offline  bernz
Messages: 4
Registered: February 2010
Location: Philippines
Junior Member
How do set the header "theme"?
Re: GridCtrl samples with all functions and methods [message #26819 is a reply to message #26809] Mon, 31 May 2010 08:59 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1391
Registered: September 2007
Senior Contributor
bernz wrote on Sun, 30 May 2010 19:06

How do set the header "theme"?

You can use normal Chameleon themeing methods, but the header style is shared between HeaderCtrl, ArrayCtrl and GridCtrl, so you need to create or edit a HeaderCtrl::Style.

HeaderCtrl::Style& s = HeaderCtrl::StyleDefault().Write();
// use s
Re: GridCtrl samples with all functions and methods [message #26820 is a reply to message #26819] Mon, 31 May 2010 10:06 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1354
Registered: November 2005
Location: Poland
Senior Contributor

cbpporter wrote on Mon, 31 May 2010 02:59

bernz wrote on Sun, 30 May 2010 19:06

How do set the header "theme"?

You can use normal Chameleon themeing methods, but the header style is shared between HeaderCtrl, ArrayCtrl and GridCtrl, so you need to create or edit a HeaderCtrl::Style.

HeaderCtrl::Style& s = HeaderCtrl::StyleDefault().Write();
// use s


The easiest way to do that is to use SetTheme method:
grid.GetDisplay()->SetTheme(1);

There are 7 themes available now (see GridCtrl.img). If you want to modify theme as cbporter suggested you have to call grid.Chameleon() first.
Re: GridCtrl samples with all functions and methods [message #26841 is a reply to message #26820] Wed, 02 June 2010 03:08 Go to previous message
bernz is currently offline  bernz
Messages: 4
Registered: February 2010
Location: Philippines
Junior Member
Sorry, I'm a newbie...can you provide a complete code sample...thanks a lot!
Previous Topic: Problem - GridCtrl::Get(int,int) with DropTree
Next Topic: Copy GridCtrl cell when read only
Goto Forum:
  


Current Time: Wed Sep 18 07:52:57 CEST 2019

Total time taken to generate the page: 0.01245 seconds