realbasic-nug
[Top] [All Lists]

Keyboard Counter Porting to Obj-C

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Keyboard Counter Porting to Obj-C
From: Chris Kastorff <jckastorff at ix dot netcom dot com>
Date: Thu, 30 Sep 2004 13:33:40 -0400
Delivered-to: realbasic-nug at lists dot realsoftware dot com
This isn't a "New Users" question, but I couldn't find another suitable mailing list. Bear with me:

I've been looking for a way to check how many keys have been pressed and how many clicks the user has made, and the only way I can find is creating a loop (in a timer) that checks to see if a key had been pressed, and then add one to the key count (same method for clicks). Here's the code I'm using:

  // clicks
  if system.mousedown<>lastmousedown then
    if lastmousedown then
      clicks=clicks+1
    end if
    lastmousedown=system.mousedown
  end if

  // keys
  for i=1 to 127
    if keyboard.AsyncKeyDown(i) then
      if not keysdown(i) then
        keysdown(i)=true
      end if
    elseif keysdown(i) then
      keys=keys+1
      keysdown(i)=false
    end if
  next

plus two globals: keysdown(128) as boolean, keys as integer.

I want to port this to a faceless application, but I don't have RB5.5. I have 5.2.4, and it doesn't have console application support.

My question is: How does RB (inside itself) check keyboard.AsyncKeyDown and system.MouseDown? I want to make a mac key/click counter, but I haven't been able to find a way to do this in Obj-C.

        -Chris K.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>