Frazier, Joe Jr wrote:
> > but I still don't know what to do when you just say use Win32::GUI ;-)
>
> <vote type="my opinion">Use old style by default.  This avoids users
> having to change thier code until they are ready to totally update thier
> code.</vote>

yes, this is sure. by default the old style is used, the problem is when you
don't use it and put an -events option on something. maybe I should
process -events options *only* if you said:

    use Win32::GUI Event_Model => 'byref';

otherwise they're simply ignored.

> I would probably do something simular to the way XML::SAX::* works and
> do this
>
> [...]
>
> -events => {
>             Terminate => $gui->myhandler();

not quite... should be something like:

              Terminate => \&{ $gui->myhandler };

arguments to -events can be:
  - a subroutine name (string)
  - a reference (eg. \&)
  - an anonymous sub (eg. sub { .. })

BTW, I didn't understand the use of My::Package ... but maybe it's just me.

> Now, the question is, how does it work to pass in stuff such as the
> listview passing the row clicked?  or do we have to handle all that
> ourselves?  If this is covered in the docs(are the docs more fleshed
> out?), let me know and I will check there.

ops, sorry, I forgot to mention this :-)
for your joy (and many other's too), all NEM events pass the object they're
referring to as their first argument, while subsequent arguments are the
same as their non-NEM counterparts.

so you can do this:

  $Window->AddButton(
    # ...
    -name => "Button1",
    -onClick => sub {
      my($self) = @_;
      print "you clicked button: $self->{-name}\n";
    },
  );

and this will print out: you clicked button: Button1

an ItemClick event for a ListView would look like:

  -onItemClick => sub {
    my($self, $item) = @_;
    # do something with $item
  },

> Sorry to be a pain, but i am so excited to check this out and have a
> few questions on gotchas I have ran into in the past before migrating.

don't worry, this kind of pain is welcome :-)

cheers,
Aldo

__END__
$_=q,just perl,,s, , another ,,s,$, hacker,,print;


Reply via email to