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 » Community » Newbie corner » tracking GridCtrl selection
Re: tracking GridCtrl selection [message #32765 is a reply to message #32709] Tue, 07 June 2011 08:21 Go to previous messageGo to previous message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

You can iterate over all cells:
for(int i = 0; i < grid.GetCount(); i++)
  for(int j = 0; j < grid.GetColumnCount(); j++)
  {
      if(grid.IsSelected(i, j))
      {
          ... do anything ...
      }
   }

for checking rows only or you can use this macro
FOREACH_SELECTED_ROW(grid)
{
   PromptOK(Format("Selected row: %d", grid.GetCurrentRow()));
   ... do my code...
}


As you noticed you can also retrieve number of selected rows/cells:
int selectedRows = grid.GetSelectedCount();
int selectedCells = grid.GetSelectedItemsCount();

Quote:


CTRL+LMB or a Shift+LMB selection (they differ by 1)


Thanks. I'll try to fix that.

There are no GetSelectionBegin/End() methods (what should they return if there are multiple selections?)
 
Read Message
Read Message
Read Message
Previous Topic: No preprocessor output
Next Topic: How to set GridCtrl header font size?
Goto Forum:
  


Current Time: Fri Jul 18 23:06:49 CEST 2025

Total time taken to generate the page: 0.03206 seconds