Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » How can I select a single row in a data grid? Collapse All
Subject Author Date
Georgios Kapetanakis Oct 11, 2007 - 5:57 AM

Dear Support,

I am using Prof-UIS v. 2.61. I have created a CExtGridWnd in my application and set the style to select full rows. This works as expected, i.e. it selects the whole row when I click on a row in the grid.

However, I have been unable to work out how to programmatically select a single row in the grid. There is no function that I can find that I can supply a row number to select. Something similar to EnsureVisibleRow() would be helpful, since it is very complex to have to deal with "selection rectangles" for such a simple operation. Can you please advise on the best way to achieve row selection in code?

Thank you for any help you can offer.


Technical Support Oct 11, 2007 - 10:10 AM

Just use the CExtGridBaseWnd::SelectionSet() method

CPoint ptSelection( 0, nRowNo );
SelectionSet( ptSelection );
In the full row mode, the column number will simply be ignored.

Georgios Kapetanakis Oct 11, 2007 - 10:07 AM

Thank you Suhai,

This works quite well!

I also managed to figure it out in the end... I used something like this:

grid.SelectionSet(CRect(0, lRowNo, grid.ColumnCountGet(), lRowNo));

Of course, your way is a lot clearer, so I’ll use it instead!

Many thanks.


Suhai Gyorgy Oct 11, 2007 - 8:57 AM

For me FocusSet(CPoint(0, lRowNo)) was little more comfortable (one of its default parameters indicates to set the selection, as well)