in reply to Subroutines not working right

Point of order: please put code in <code> ... </code> tags, as per writeup formatting tips.

Anyway,

onClick => &Button_Click(1)

is probably not what you want. That will pass the return value of the call to Button_OnClick(1). If you want to pass a reference to a function, use -onClick => \&Button_OnClick.

I'm not sure that -onclick is even a valid argument, but then again, I don't know Win32::GUI. You may want to re-read the documentation.

Replies are listed 'Best First'.
Re^2: Subroutines not working right
by stringplayer92 (Initiate) on Feb 21, 2008 at 23:48 UTC
    Thanks for the tip,
    I actually realized that right before seeing your reply...
    I will look into using a reference to the function
    Windows programming is so annoying....

    Stringplayer92

      I notice you had an argument. If you need a "reference with arguments", create a small anon routine
      $func = \&foo; -vs- $func = sub { foo(1) };
        I realized the error of my ways. Thanks only 80 more lines of code to right...

        Stringplayer92

        Windows is a 32 bit patch to a 16 bit GUI based on an 8 bit
        operating system, written for a 4 bit processor by a 2 bit
        company which cannot stand 1 bit of competition.