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 » U++ Library : Other (not classified elsewhere) » minimalist example with GridCtrl
minimalist example with GridCtrl [message #6451] Mon, 13 November 2006 09:32 Go to next message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
Hello,

I've done some experiment with the GridCtrl I got from the Nico's application.
The gridctrl looks great but I wonder if it has some capability of the arrayctrl. For example can I add a droplist or a toggle button to a column?
Moreover, I was able to let appear the control but not to edit its cells. I used several options but the edit was not possibile. I would like to know if there is a very little piece of code that set a gridctrl with all the cells editable.

Thank you
Luigi
Re: minimalist example with GridCtrl [message #6456 is a reply to message #6451] Mon, 13 November 2006 10:48 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

forlano wrote on Mon, 13 November 2006 03:32

Hello,

I've done some experiment with the GridCtrl I got from the Nico's application.
The gridctrl looks great but I wonder if it has some capability of the arrayctrl. For example can I add a droplist or a toggle button to a column?
Moreover, I was able to let appear the control but not to edit its cells. I used several options but the edit was not possibile. I would like to know if there is a very little piece of code that set a gridctrl with all the cells editable.

Thank you
Luigi

Yes it is possible. Just do:

EditString edit;
DropList drop;

grid.AddColumn("c0").Edit(edit);
grid.AddColumn("c1").Edit(drop);


That should be enough. I don't remember what edit mode was set as default in 0.95 version. But to edit row (all ctontrols are visible) add grid.EditMode(0). In that mode controls becom visible if you press enter or make double click on row.

Please paste your code here (or send it to me) so I could check it.

New version of grid has support for "control in every cell" mode and a tutorial. I will public it very soon.
Re: minimalist example with GridCtrl [message #6457 is a reply to message #6456] Mon, 13 November 2006 10:49 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

You can also download HomeBudget sources from my page (dgs.pac.pl) It uses grid in many places.
Re: minimalist example with GridCtrl [message #6468 is a reply to message #6457] Mon, 13 November 2006 18:56 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
unodgs wrote on Mon, 13 November 2006 10:49

You can also download HomeBudget sources from my page (dgs.pac.pl) It uses grid in many places.


Thanks a lot for your answer.
Unfortunately I still cannot make the cell editable!
The method grid.EditMode(0) is not recognised as belonging to gridctrl.
I've downloaded the 0.95 version but this piece of code do not want to show editable cells.
I put a gridctrl in the layout of designer and named it gc. than added these line in the constructor:
...
    gc.Inserting();
    gc.Appending();
    gc.Moving();
    gc.Removing();
    gc.Navigating();
    gc.Searching();
    gc.Editing();

    gc.AddColumn("name",19);
    gc.AddColumn("fed",4);
    gc.AddColumn("rtg",4);
    gc.AddColumn("title",4);
    for (i=0; i<4; i++) gc.Add("0","0","0","0");

It shows a nice 4x4 table but not editable Confused
What I am missing?
Luigi
Re: minimalist example with GridCtrl [message #6469 is a reply to message #6468] Mon, 13 November 2006 19:26 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

forlano wrote on Mon, 13 November 2006 12:56


What I am missing?
Luigi


You didn't read my answer carefully Wink GridCtrl is very similar to ArrayCtrl. You must bind a column with an edit control.

Your code should like this:

...
    gc.Inserting();
    gc.Appending();
    gc.Moving();
    gc.Removing();
    gc.Navigating();
    gc.Searching();
    gc.Editing();

    EditString name, fed, rtg, title;

    gc.AddColumn("name",19).Edit(name);
    gc.AddColumn("fed",4).Edit(fed);
    gc.AddColumn("rtg",4).Edit(rtg);
    gc.AddColumn("title",4).Edit(title);
    for (i=0; i<4; i++) gc.Add("0","0","0","0");

Of course all edits should be declared in your dialog class scope (not like in the coode above in constructor).
Hope that will help you Smile

[Updated on: Mon, 13 November 2006 19:27]

Report message to a moderator

Re: minimalist example with GridCtrl [message #6470 is a reply to message #6469] Mon, 13 November 2006 20:06 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
unodgs wrote on Mon, 13 November 2006 19:26

forlano wrote on Mon, 13 November 2006 12:56


What I am missing?
Luigi


You didn't read my answer carefully Wink GridCtrl is very similar to ArrayCtrl. You must bind a column with an edit control.



...oopsss...
I believed that the edit ctrl was some feature present by default, and should be added only special ctrl like droplist and togglebutton.
Now it works Very Happy
Thank you,
Luigi
Re: minimalist example with GridCtrl [message #6471 is a reply to message #6470] Mon, 13 November 2006 20:08 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

Maybe you're right about auto edits. I think it could be done for strings, numbers and booleans.
Re: minimalist example with GridCtrl [message #6472 is a reply to message #6471] Mon, 13 November 2006 20:26 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
unodgs wrote on Mon, 13 November 2006 20:08

Maybe you're right about auto edits. I think it could be done for strings, numbers and booleans.


I agree for that very common type. This is a nice feature that could prevent the user to add manually many editfields and bind them as we saw in case of many editable columns. In my next app I've 8. But that's not a problem Smile
But it could be important if one wants to use the gridctrl as a small spreedsheet.

BTW, I saw that with the TAB key I can move from one cell to the right. Unfortunately when I arrive at the end of the table it adds a new row. But my table has fixed rows! How to disable the autoappendrow at the end of the table? I tried
.Appending(false); with no result.

Thanks,
Luigi
Re: minimalist example with GridCtrl [message #6473 is a reply to message #6472] Mon, 13 November 2006 20:42 Go to previous message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

Add to your code:
grid.TabAddsRow(false)
Previous Topic: Close() callback not conditioned in a dialog
Next Topic: Horizontal and Vertical inverted in UPP?
Goto Forum:
  


Current Time: Sun Apr 28 22:49:39 CEST 2024

Total time taken to generate the page: 0.03802 seconds