U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » GridCtrl: master - detail
Re: GridCtrl: master - detail [message #33650 is a reply to message #33641] Sat, 03 September 2011 21:58 Go to previous messageGo to previous message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

forlano wrote on Sat, 03 September 2011 04:46

Hello,

is there a similar functionality in GridCtrl?

If not, are there snippet code able to simulate it?

I guess they should be in HomeBudget but the code look complex and I can't find what it is real useful. So some better localization of this part of code would be great.

Thanks,
Luigi

GridCtrl has no direct support for master/details functionality. But it's very easy to implement it.
GridCtrl master, details;

master.AddIndex(ID);
master.AddColumn(LIBRARY_NAME, "Library name");
master.WhenRowChange = THISBACK(UpdateDetails);

details.AddColumn(BOOK_NAME, "Book name");

void UpdateDetails()
{
    SQL * Select(ID, BOOK_NAME).From(BOOKS).Where(LIBRARY_ID == master(ID)); //master(ID) returns ID from currently selected row
    while(SQL.Fetch)
        details.Add(SQL[BOOK_NAME]);
}
   


In this example master contains list of libraries and details contains books from selected library. Of course you have to add clearing details grid if new library is added. Is this helpful for you or you needed to know something more complicated?
 
Read Message
Read Message
Read Message
Previous Topic: GridCtrl/DropGrid problem: Value related.
Next Topic: [SOLVED] ArrayCtrl and German characters
Goto Forum:
  


Current Time: Sun Oct 04 07:41:06 GMT+2 2026

Total time taken to generate the page: 0.20672 seconds