From: Robert M. <rm...@po...> - 2007-01-08 22:34:23
|
Leif Andersson wrote: >> But there is no GetName() method for the button object (or indeed any >> Win32::GUI object). Slightly naughty, and I shouldn't be encouraging >> this [1], but the object's name is stored in it's '-name' hash slot, > so >> you can replace: >> print $self->GetName(), "\n"; >> with >> print $self->{-name}, "\n"; > > A handful of the attributes used to define the object seems available in > this (unrecommended) manner. > > But is it possible to add attributes? Not recommended: add your attributes to the object's hash. $object->{-parent} = $whatever; Recommended: Use the UserData() method - this is exactly what this method is intended for: $object->UserData($whatever); # store scalar with object my $w = $object->UserData(); # retrieve previously stored scalar Regards, Rob. |