On Wed, 2008-07-23 at 15:09 -0400, Roode, Eric wrote:
> I just spent the past few hours debugging this.  I have narrowed down
> the problem to the scope of the font object.
> 
Yes, known bug. 
> 
> More importantly: Are there any other things that I don't know about
> that are going to bite me if they go out of scope?

Out of my head:

fonts, cursors, menus, icons, bitmaps and accelerators.

> I am trying to make my initialization and setup code modular, so it can
> actually be maintained, instead of one big glomp of spaghetti.  This
> sort of behavior does not help.
> 

Try to store the perl object in the container window:

sub initiaalize_heading {
  my $win = shift;
  my $font = ...;

  my $lab = $win->AddLabel(...,-font => $font);
  # Workaround for window not storing the perl object.
  $lab->{_Font} = $font; # I use the '_' prefix to avoid name 
                         # clashes with children.
  ...
}





-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Reply via email to