[Fixed] Re: Custom Cell Renderer causing text to overflow

2008-04-25 Thread Doug Breshears
Thanks Mark for the nudge. Here is the new (Working method) sub Draw { debug "Renderer:Draw\n"; my( $self, $grid, $attr, $dc, $rect, $row, $col, $sel ) = ( shift, @_ ); $self->SUPER::Draw( @_ ); $dc->SetPen( wxBLACK_PEN ); $dc->SetBrush( wxWHITE_BRUSH ); $dc->SetFont(Wx::SystemSettings:

Re: Custom Cell Renderer causing text to overflow

2008-04-25 Thread Doug Breshears
It's funny but no the demo did not cover this. So, I use $dc->GetTextExtents($string) to get the size of the string, then compare it with $rect to see if it is going to overflow, then if it will what do I do? Just start chopping off one char in a loop and checking to see if it fits? Thanks f

Re: [Fixed] Re: Custom Cell Renderer causing text to overflow

2008-04-25 Thread Mark Dootson
Hi Doug, Your method is 'smart' in that you could extend it to write out whole words only and maybe add some indication that all the text is not shown. I've seen code that does this - but again it is probably C++ code that I'm mis-remembering. It should be much easier in Perl anyway. You can

Re: Custom Cell Renderer causing text to overflow

2008-04-25 Thread Mark Dootson
Hi, I know very little about wxGrid, but have used wxDC and related objects a fair bit. Therefore something jumps out from the code. Using $grid->SetCellOverflow( $row, $col,0) should be used outside your subroutine to set the extents of the $rect passed in and it is your job in a custom re