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 » ArrayCtrl, HeaderCtrl & GridCtrl » Retrieving column index like a row
Retrieving column index like a row [message #40484] Wed, 07 August 2013 13:31 Go to next message
crydev is currently offline  crydev
Messages: 151
Registered: October 2012
Location: Netherlands
Experienced Member
Hello,

I am using the following code to retrieve the data from the currently selected row in an ArrayCtrl.

const int row = this->mUserAddressList.GetCursor();
if (row >= 0 && mUserAddressList.GetCount() > 0)
{
     // The selected row is not -1, so no error will occur when data retrieval is attempted.
}


I am wondering, is it possible to also retrieve the column the cursor is in? I would like to implement different behavior between different columns.

P.S.

I bug I have using this code though, is that since always one row is selected if you click anywhere in the ArrayCtrl, even by clicking outside of a row, still one will be selected. This only applies to a situation where there are less rows then available draw space. Is there a way to fix this? I can imagine I am using the wrong code to retrieve row indexes.

Thanks in advance!

[Updated on: Wed, 07 August 2013 13:32]

Report message to a moderator

Re: Retrieving column index like a row [message #40583 is a reply to message #40484] Sun, 18 August 2013 16:40 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
crydev wrote on Wed, 07 August 2013 07:31

Hello,

I am using the following code to retrieve the data from the currently selected row in an ArrayCtrl.

const int row = this->mUserAddressList.GetCursor();
if (row >= 0 && mUserAddressList.GetCount() > 0)
{
     // The selected row is not -1, so no error will occur when data retrieval is attempted.
}


I am wondering, is it possible to also retrieve the column the cursor is in? I would like to implement different behavior between different columns.



ArrayCtrl does not have selectable columns, just rows.

However, there is GetClickColumn, which returns the last column you have clicked on.

Mirek
Re: Retrieving column index like a row [message #40683 is a reply to message #40583] Sun, 01 September 2013 20:10 Go to previous message
crydev is currently offline  crydev
Messages: 151
Registered: October 2012
Location: Netherlands
Experienced Member
Thanks Mirek!

This can be used to achieve the behavior I desire. Smile
Previous Topic: [BUG] GridCtrl uses wrong sorting icon order.
Next Topic: ArrayCtrl.AsQtf bug?
Goto Forum:
  


Current Time: Thu Apr 18 11:27:48 CEST 2024

Total time taken to generate the page: 0.02202 seconds