Loading ...
Sorry, an error occurred while loading the content.
 

Re: keypress

Expand Messages
  • amorphis_bwd
    Thanks for that. i installed it using ppm cos nmake seems to crash when its compiling something that uses xs. anyway, i ve run into a little bit of a problem.
    Message 1 of 4 , May 22, 2002
      Thanks for that. i installed it using ppm cos nmake seems to crash
      when its compiling something that uses xs. anyway, i've run into a
      little bit of a problem. what i'm trying to do with iskeypressed is
      use it as a replacement for accelerators cos i'm using win32::gui and
      accelerators don't work in the current version. so the script kinda
      goes like this..

      use Win32::GuiTest qw/IsKeyPressed/;


      $Timer = new GUI::Timer("Timer",1); #1ms break betwenn running the
      _timer event

      sub Timer_Timer {
      if (IsKeyPressed("s")) {
      &Settings_Click;
      }
      }

      and so on and so forth. when i run it it tells me undefined
      subroutine &main::IsKeyPressed, but it obviously find Win32::GuiTest
      otherwise we wouldn't get to that point. any ideas as to what
      happening? also does iskeypressed handle things like alt+s?

      --- In perlguitest@y..., "erngui" <erngui@a...> wrote:
      > Hi,
      >
      > --- In perlguitest@y..., "amorphis_bwd" <sepal@h...> wrote:
      > > hi. i'm trying to get keypress to recognise normal a-z characters
      > but
      > [...]
      > > tell me what i'm doing wrong?
      >
      > You did nothing wrong. The version IsKeypressed that I uploaded
      only
      > supports "special" keys. That means it understands the same things
      as
      > SendKeys does "F11", "BS", "ENTER", etc.
      >
      > I've just uploaded a fix:
      > http://groups.yahoo.com/group/perlguitest/files/Win32-GuiTest-
      > 1.49.1.zip
      >
      > These are the changes I made to guitest.xs and eg/keypress.pl.
      >
      > diff -r1.13 GuiTest.xs
      > 959a960,961
      > > else if (strlen(name)==1 && (isdigit(*name) || isalpha
      (*name)))
      > > RETVAL = GetAsyncKeyState(toupper(*name));
      >
      > diff -r1.3 keypress.pl
      > 10c10
      > < @keys = qw/ESC F5 F11 F12/;
      > ---
      > > @keys = qw/ESC F5 F11 F12 A B C/;
      >
      > Now you should be able to do:
      >
      > IsKeyPressed("A");
      > IsKeyPressed("7");
      >
      > Regards,
      > Ernesto.
      > --
      > Ernesto Guisado
      > mailto:erngui@a...
      > http://triumvir.org
    • erngui
      Hi, ... [...] ... Win32::GuiTest No idea, but you could try two things to see what happens: 1) use strict; at the beginning of your script and using perl -wc
      Message 2 of 4 , May 23, 2002
        Hi,

        --- In perlguitest@y..., "amorphis_bwd" <sepal@h...> wrote:
        [...]
        > and so on and so forth. when i run it it tells me undefined
        > subroutine &main::IsKeyPressed, but it obviously find
        Win32::GuiTest

        No idea, but you could try two things to see what happens:

        1) use strict; at the beginning of your script and using "perl -wc
        yourscript.pl" to see if it picks up anything.

        2) Try to use the function directly like:
        Win32::GuiTest::IsKeyPressed("s");

        Could be some problem in my export code, but I think it's unlikely as
        eg/keypress.pl works? Have you tried eg/keypress.pl to see if it
        works?

        > happening? also does iskeypressed handle things like alt+s?

        Nope. Only keys without modifiers. Should be easy to extend as all
        the parsing code is already there for SendKeys. I'll put it on my
        todo list.

        Regards,
        Ernesto.
        --
        Ernesto Guisado
        mailto:erngui@a...
        http://triumvir.org
      Your message has been successfully submitted and would be delivered to recipients shortly.