|
|
Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » GridCtrl samples with all functions and methods
|
|
|
|
Re: GridCtrl samples with all functions and methods [message #26019 is a reply to message #26018] |
Fri, 26 March 2010 11:05   |
 |
koldo
Messages: 3432 Registered: August 2008
|
Senior 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 
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 #26820 is a reply to message #26819] |
Mon, 31 May 2010 10:06   |
|
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.
|
|
|
|
Goto Forum:
Current Time: Sat Apr 26 22:05:09 CEST 2025
Total time taken to generate the page: 0.01254 seconds
|
|
|