Re: [Pipmak-Users] Re: Hotspot maps
Status: Alpha
Brought to you by:
cwalther
From: Christian W. <cwa...@gm...> - 2004-09-30 08:55:55
|
Will Meyer wrote: > ok, a returns 97 and the space bar returns 32. OK, so we were not on the right track... > if key == string.byte("a") then > pipmak.print("ok") > > now, when i press a, it prints "ok," and then it says "Unused key 97 > pressed," > and the normal key commands still don't work. Well, I finally found the problem. I made a mistake when I wrote that code off the top of my head without testing it. The onkeydown handler needs to return false (or nothing) if it handled the keypress itself, and true if it has to be passed on to the global handler, not the other way around. Like so: onkeydown ( function(key) if key == string.byte(" ") then pipmak.saveequirect(360, 180) --width, height return false --keypress was handled else return true --keypress needs to be passed along to the global key handler end end ) My bad! Seeing that it confused myself, I could maybe change that. Since it's not documented yet, I figure it could be changed without breaking too many existing projects. What do you think, is it more intuitive to have the keydown handler return whether the keydown needs to be passed on (as it is now), or whether it has handled the keypress (as I was assuming when I wrote the faulty code)? By the way, I'm not sure (without testing) where pipmak.saveequirect() saves its image file in the current version. It might be next to the application, or it might be somewhere inside the application (use "Show package contents" in the contextual menu in the Finder to find out). -Christian |