![]() |
Report control current cell? |
Post Reply ![]() |
Author | |
brianh ![]() Groupie ![]() Joined: 30 April 2004 Location: United Kingdom Status: Offline Points: 83 |
![]() ![]() ![]() ![]() ![]() Posted: 05 January 2005 at 11:31am |
Hi, in my application the user can dynamically add columns to the report control and I want to allow them to remove columns too, but there doesn't appear to be any concept of a current cell in the report control so there is no intuitive way to select a column for deletion. I can find the focused row but there is no equivalent focused column. |
|
![]() |
|
Boyd ![]() Senior Member ![]() Joined: 08 December 2003 Location: United States Status: Offline Points: 285 |
![]() ![]() ![]() ![]() ![]() |
I'm not certain if there is a way to determine the focused column, but you do have one alternative. I always use the right-click menu on the column header for actions such as this, and it is possible to determine which column the user right-clicked on. I don't use the MFC version, but the ActiveX version has a ColumnClick event as well as a HitTest method (both of which can be used to provide right-click menus for a column). The MFC version must surely have an equivalent approach. Since you know which column triggered the right-click menu, you'll know which column to remove if the user chooses that action. |
|
![]() |
|
brianh ![]() Groupie ![]() Joined: 30 April 2004 Location: United Kingdom Status: Offline Points: 83 |
![]() ![]() ![]() ![]() ![]() |
Thanks Boyd, I never thought about the headers, I should be able to handle the normal MFC message for the context menu and by using the HitTest() method of the column header I could then find the associated column and add/enable the "delete" item in the context menu. I like to use a context menu for this kind of thing too, but I usually have a main menu item and toolbar button for the same purpose, so it would be nice if the grid maintained a "current column" to allow this, but until then the context menu will have to do. Thanks again. Edited by brianh |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |