wxGrid help again... Topic is solved

Are you writing your own components and need help with how to set them up or have questions about the components you are deriving from ? Ask them here.
Post Reply
pbrown520
Knows some wx things
Knows some wx things
Posts: 38
Joined: Tue Oct 09, 2007 4:38 pm

wxGrid help again...

Post by pbrown520 » Wed Jan 23, 2008 10:01 pm

Ok,

Does anyone know how to make a wxGrid where the only column that is selectable is the 1st column, i.e. you have a 4 column table with multiple rows and the only column that allows a cursor is the 1st column. I've been trying to do this to no avail.

Thanks in advance.

clyde729
Super wx Problem Solver
Super wx Problem Solver
Posts: 426
Joined: Mon May 29, 2006 10:50 pm
Location: Jena, Germany

Post by clyde729 » Mon Jan 28, 2008 7:25 am

Please tell us more details. Do you want to prevent the "selection" of cells or the movement of the gridcursor?
OS: Windows XP Home, Compiler: MingW, Version: wxWidgets 2.8.0, IDE: wx-Devcpp

pbrown520
Knows some wx things
Knows some wx things
Posts: 38
Joined: Tue Oct 09, 2007 4:38 pm

Post by pbrown520 » Tue Jan 29, 2008 4:48 pm

I want the 1st column to be completely normal and the other 3 columns to simply be an area to display data. I don't want the user to be able to select the cell with a click and I don't want the cells to be able to accept the focus. I guess that I want to prevent the movement of the gridcursor as well. Essentially what I want is 1 column that is active and 3 columns that are for display only and have no other function to the user.

Does this help at all?

clyde729
Super wx Problem Solver
Super wx Problem Solver
Posts: 426
Joined: Mon May 29, 2006 10:50 pm
Location: Jena, Germany

Post by clyde729 » Tue Jan 29, 2008 10:08 pm

O.k., don't know, if this is possible, but you could do the following:

- make the last 3 cols readonly.
- catch the wxEVT_GRID_SELECT_CELL event
- check in the handler, if the col position is the first one
- if not, set the cursor via wxGrid::SetGridCursor

It shouldn't produce an endless loop. Maybe wrap your "setgridcursor" call inside a BeginBatch and EndBatch to prevent showing up that the selection has worked (just for some milliseconds, of course ;-) )
OS: Windows XP Home, Compiler: MingW, Version: wxWidgets 2.8.0, IDE: wx-Devcpp

Post Reply