how to get wxGrid focus cell in custom GridCellRenderer? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
sunose
Earned a small fee
Earned a small fee
Posts: 16
Joined: Tue Jul 07, 2009 2:01 am

how to get wxGrid focus cell in custom GridCellRenderer?

Post by sunose » Tue Aug 25, 2009 12:17 pm

defined a custom cell render from derive wxGridCellRenderer class.

on overide Draw method:

I want get current grid focus cell Row and Col coordinate

but the grid GetSelectedCells,GetSelectedRows get Array count is zero.

when use keyboard arrow up,down,left or right to move the indicator rect on grid view , the Draw method can't get the focus cell (row,col) coordinate use uppon method.

anyway to get grid focus cell in custom cell renderer Draw method ?

thanks.

tan
Moderator
Moderator
Posts: 1471
Joined: Tue Nov 14, 2006 7:58 am
Location: Saint-Petersburg, Russia

Re: how to get wxGrid focus cell in custom GridCellRenderer?

Post by tan » Tue Aug 25, 2009 2:39 pm

Hi,
sunose wrote:defined a custom cell render from derive wxGridCellRenderer class.

on overide Draw method:

I want get current grid focus cell Row and Col coordinate

but the grid GetSelectedCells,GetSelectedRows get Array count is zero.

when use keyboard arrow up,down,left or right to move the indicator rect on grid view , the Draw method can't get the focus cell (row,col) coordinate use uppon method.

anyway to get grid focus cell in custom cell renderer Draw method ?

thanks.
well, why do you need current focus cell in Draw() method?
Just to draw selection indicator in the selected cell? OK, Draw() has isSelected parameter, why not to take advantage of it?
OS: Windows XP Pro
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10

sunose
Earned a small fee
Earned a small fee
Posts: 16
Joined: Tue Jul 07, 2009 2:01 am

Re: how to get wxGrid focus cell in custom GridCellRenderer?

Post by sunose » Tue Aug 25, 2009 11:44 pm

hi,tan:

because I am Familiar java Swing JTable,I want do some special draw effect when the grid view render time.

for this ,I need get current rederering cell's distance from focus cell and then do someting .

the isSelected just when focus cell be renderering time is true.

this not I want.

yesterday ,I read the grid.h file and find the GetCursorRow and GetCursorColumn two method,they are that I want!


thank your reply.

Post Reply