How to get the type of grid cell renderer ? 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
nandakishore
Experienced Solver
Experienced Solver
Posts: 57
Joined: Wed Feb 25, 2015 2:09 pm
Location: Chennai, India

How to get the type of grid cell renderer ?

Post by nandakishore »

I have loaded few wxGrid cells with wxGridCellChoiceRenderer and wxGridCellBoolRenderer randomly.
I click on any cell which may have renderers or empty cells. So in EVT_GRID_CELL_LEFT_CLICK event how to know that
that cell have the renderer and which type of renderer it is?
Got a Problem???..No worry..Focus on Solution not on Problem :P
coderrc
Earned some good credits
Earned some good credits
Posts: 141
Joined: Tue Nov 01, 2016 2:46 pm

Re: How to get the type of grid cell renderer ?

Post by coderrc »

I've never tried it, but you might get some love from using IsKindOf() on the event object
http://docs.wxwidgets.org/trunk/classwx ... 713404b01e
nandakishore
Experienced Solver
Experienced Solver
Posts: 57
Joined: Wed Feb 25, 2015 2:09 pm
Location: Chennai, India

Re: How to get the type of grid cell renderer ?

Post by nandakishore »

I have already tried this But no use.
when we query the grid like GetCellRenderer() it will give the renderer
then from the renderer there is no function called IsKindOf.
Got a Problem???..No worry..Focus on Solution not on Problem :P
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to get the type of grid cell renderer ?

Post by doublemax »

If this information is not easily available, it's a good indicator that you're doing something wrong or at least unusual. For what purpose do you need this information in a click event handler?
Use the source, Luke!
nandakishore
Experienced Solver
Experienced Solver
Posts: 57
Joined: Wed Feb 25, 2015 2:09 pm
Location: Chennai, India

Re: How to get the type of grid cell renderer ?

Post by nandakishore »

doublemax wrote:If this information is not easily available, it's a good indicator that you're doing something wrong or at least unusual. For what purpose do you need this information in a click event handler?
I fill gird cells with combo box renderer and button renderer randomly so i need to know what kind of renderer does the cell have
when EVT_GRID_CELL_LEFT_CLICK this event is triggered .
Got a Problem???..No worry..Focus on Solution not on Problem :P
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to get the type of grid cell renderer ?

Post by doublemax »

But why? Don't the cells have different celleditors assigned to them which will take care of the editing for you?
Use the source, Luke!
nandakishore
Experienced Solver
Experienced Solver
Posts: 57
Joined: Wed Feb 25, 2015 2:09 pm
Location: Chennai, India

Re: How to get the type of grid cell renderer ?

Post by nandakishore »

I can differentiate the renderers by setting setclientdata() like below in wxGridCellButtonRenderered and wxGridCellChoiceRenderer

SetClientData("Button Renderer");
SetClientData("Combo Renderer");

in EVT_GRID_CELL_LEFT_CLICK event function i can get the clientdata and get the task done

char* rendererinfo = (char*)cellren->GetClientData();
Got a Problem???..No worry..Focus on Solution not on Problem :P
Post Reply