Hi Jim,

I had a look at this.

As I understand it your update adjusts the size of the column while ignoring any HTML like <u>Underlined Header</u>, to ignore the width of the formatting characters <u></u>. It's a nice idea.

This is the sort of thing that we could add onto wxPerl as an improvement over wxWidgets to make it a preferred choice.

It would be great to have a repository of these things on the wxPerl wiki (http://wiki.wxperl.nl/Main_Page). Once it's working of course!!

On 05/05/14 19:13, Jim Clark wrote:
OK, so here is one for you wxPerl whizzes out there. I really need to figure this out. I have a derived class which has the following override function for AutoSizeColumn(). There is also one for AutoSizeRow(), but I’m going to focus on this one as I believe this is where my issue is occurring. I have a program which shows a grid which updates every 10 seconds, which includes AutoSize’ing the grid. Over a period of time, (like say 1 hour), something is happening which includes a small memory leak, but something more profound with X11. When the program is quit, it will hang for a while, but only if SMART_AUTOSIZE is set to 2. If it is zero, or 1 it works fine, but when set to 2 it causes something to happen that is either a strict memory leak or some excess chattiness with the X11 server. If used with Exceed on OSX, it will cause it to lock up the server altogether, to the point it requires to be killed (-9).

I've never had a memory leak in Perl. I don't even know what one would look like. I've had programs crash, hang, stackdump etc, but usually because of some stupidity on my part. Perl just seems exceptionally durable. wxPerl is very simple. Sometimes things are missing (like wxGRID_AUTOSIZE), but things don't normally malfunction. I suspect that this problem is in wxWidgets, in which case you should try posting on wx-us...@googlegroups.com.

However, I did crank up your code (after replacing GRID_SIZE_PAD with 0), but I wasn't clear how to call it.

Could you post a few lines with a test harness showing how to call your code. I've got a couple of long train journeys today, so I'm happy with the distraction!

return if $self->IsColHidden($col);

I'm pretty sure AutoSizeColumn already does "return if $self->IsColHidden($col);" ( ie if coulmn size == 0), so you shouldn't need that line.
my $cwc = defined $self->{COLUMN_WRAP}{$col}{MODE} ? $col : 'ALL';
Could you show us what the relevant part of $self look like? I.e.
$self->{COL_SIZE}{$col})
$self->{COLUMN_WRAP}{$cwc}{MODE};
    $self->{SMART_AUTOSIZE}
        $self->{HIDE_COLUMN_LABEL}

if ($w) {
$self->SetColSize($col,$w + GRID_SIZE_PAD);

I set GRID_SIZE_PAD to 0 here.

#wrapString( <string>, <delimiter>, <width> [, <mode> ] )
#<string>string to be wrapped
#<delimiter> regex expression for delimiter
#<width>max width of the output in characters (string will be wrapped to not exceed this value) #<mode>If set, then space delimiters will be compressed (IE: ' ' --> ' ').
#
#Returns the wrapped string.

Could you give some examples?

Best wishes,

Steve.

Reply via email to