From: Jeremy W. <jez...@ho...> - 2009-01-11 19:35:58
|
> # Begin button row > $btn_DBWindowDefault = $DBWindow->AddButton( > -name => 'DBWindowDefault', > -text => 'Ok', > -tabstop => 1, > -default => 1, # Give button darker border > -ok => 1, # press 'Return' to click this button > -pos => [ 25, $nexthoriz += 25 ], > -size => [ 60, 20 ], > ); > ... > $DBWindowsb = $DBWindow->AddStatusBar(); > ... > # Resize, position and display > $DBWindow->Resize( $w, $h ); > $DBWindow->Move( $wx, $wy ); > > $DBWindow->Show(); > return 0; > } > ... > # What to do when the button is clicked ####################################### > sub DBWindowDefault_Click { > ... > return 0; > } > > I'm just adding "package ldms_core;" at the top and "1;__END__" at the > bottom. Any ideas? Hi, You are using the OEM (Old Event Model) where Win32::GUI assumes the event handlers are in the "main" name space. When you add a package to surround your code the sub DBWindowDefault_Click is actually ldms_core::DBWindowDefault_Click and therefore nothing is called when the event is fired (as Win32::GUI calls ::DBWindowDefault_Click) . If you want to use packages to encapsulate (which is the way to go IMHO) then you really need to use the NEM (New Event Model) where you specify a sub reference to the event handle on the creation of the object (or add it later). Alternatively, add "::" to the events which force them to be in the main name space. Cheers, Jeremy. _________________________________________________________________ Imagine a life without walls. See the possibilities http://clk.atdmt.com/UKM/go/122465943/direct/01/ |