Re: SHIFTy thoughts

2010-10-11 Thread J. Landman Gay

On 10/11/10 1:56 PM, Richmond wrote:

Thank you all for your suggestions, although they all seem
rather abstruse for simply toggling the visibility of an image.

At present I am toggling with F-12 (which puts some people's noses
out of joint, hence proposal to use SHIFT):


By default, OS X usurps the F12 key for its own uses (Dashboard display.)

I agree that you should choose a key that actually sends a keydown on 
all operating systems. Space is good if users aren't typing. Or you 
could use F12 coupled with the Option/Alt key. OS X doesn't use that.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: SHIFTy thoughts

2010-10-11 Thread Colin Holgate

On Oct 11, 2010, at 2:56 PM, Richmond wrote:

> as you can see; fairly pedestrian stuff, which is why I get all
> moist and sweaty when I think about the Shift key.


Could you use the space bar? If you can't because people are entering words in 
a field, then shift would be a problem too for anyone typing capitals.



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: SHIFTy thoughts

2010-10-11 Thread Richmond

 Thank you all for your suggestions, although they all seem
rather abstruse for simply toggling the visibility of an image.

At present I am toggling with F-12 (which puts some people's noses
out of joint, hence proposal to use SHIFT):

on rawKeyDown

---socking great, mind-bogglingly tedious switch stuff going on here

case 65481
   if the vis of img "XYZ" is true then
  set the vis of img "XYZ" to false
   else
  set the vis of img "XYZ" to true
   end if
break

---more gobbledegook

end rawKeyDown

as you can see; fairly pedestrian stuff, which is why I get all
moist and sweaty when I think about the Shift key.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: SHIFTy thoughts

2010-10-11 Thread Scott Rossi
Recently, Colin Holgate wrote:

>> Sorry, I'm not following -- the shift state is constantly polled/stored, so
>> why does the script need to care about the state at all?
>> 
> He wants to have an action happen when the user presses the shift key. Your
> variable knows whether the shift is down, but his routine would have no idea
> that it has just been pressed.

Ah, I missed the need to act on the press.  You did indeed account for that.

 
>> Maybe your script is the same idea as mine :-)
>  
> It is, but I sent mine earlier than you, just to disguise the fact that I
> copied you, while the idea was still in your head.

Being that you're on the East coast, you will will always be earlier than
me.  Or is that later?  H.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX Design


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: SHIFTy thoughts

2010-10-11 Thread Colin Holgate

On Oct 11, 2010, at 2:03 PM, Scott Rossi wrote:

> Sorry, I'm not following -- the shift state is constantly polled/stored, so
> why does the script need to care about the state at all?
> 


He wants to have an action happen when the user presses the shift key. Your 
variable knows whether the shift is down, but his routine would have no idea 
that it has just been pressed.



> Maybe your script is the same idea as mine :-)


It is, but I sent mine earlier than you, just to disguise the fact that I 
copied you, while the idea was still in your head.



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: SHIFTy thoughts

2010-10-11 Thread Scott Rossi
Recently, Colin Holgate wrote:

>> Or maybe this:
> 
> 
> Your two approaches are basically the same idea as mine, only in yours there
> is still no way for the rest of the script to know that the shift was pressed.
> You might also need an idle check, or another send, to then inspect the state
> of shiftKeyPressed, and to then do something. My email included all of that
> too.

Sorry, I'm not following -- the shift state is constantly polled/stored, so
why does the script need to care about the state at all?

Maybe your script is the same idea as mine :-)

Regards,

Scott Rossi
Creative Director
Tactile Media, UX Design


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: SHIFTy thoughts

2010-10-11 Thread Colin Holgate

On Oct 11, 2010, at 1:43 PM, Scott Rossi wrote:

> Or maybe this:


Your two approaches are basically the same idea as mine, only in yours there is 
still no way for the rest of the script to know that the shift was pressed. You 
might also need an idle check, or another send, to then inspect the state of 
shiftKeyPressed, and to then do something. My email included all of that too.



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: SHIFTy thoughts

2010-10-11 Thread Scott Rossi
Or maybe this:

on openCard
   if "trackKeys" is not in pendingMessages() then trackKeys
end openCard

on trackKeys
   set the shiftKeyPressed of me to (shiftKey() = down)
   send "trackKeys" to me in 50 millisecs
end trackKeys



Recently, I wrote:

> Here's one way to do what you ask:
> 
> [in the card script]
> 
> on openCard
>if "trackKeys" is not in pendingMessages() then trackKeys
> end openCard
> 
> on trackKeys
>set the shiftKeyPressed of me to (65505 is among the lines of keysDown())
>send "trackKeys" to me in 50 millisecs
> end trackKeys
> 
> This script sets a custom property (shiftKeyPressed) of the card that you
> can check.  You could save the state in a global variable if that's more
> convenient.  You also might want to limit key tracking to occur only during
> certain events/states of your app so you're not needlessly polling key
> states.


Regards,

Scott Rossi
Creative Director
Tactile Media, UX Design


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: SHIFTy thoughts

2010-10-11 Thread Scott Rossi
Here's one way to do what you ask:

[in the card script]

on openCard
   if "trackKeys" is not in pendingMessages() then trackKeys
end openCard

on trackKeys
   set the shiftKeyPressed of me to (65505 is among the lines of keysDown())
   send "trackKeys" to me in 50 millisecs
end trackKeys

This script sets a custom property (shiftKeyPressed) of the card that you
can check.  You could save the state in a global variable if that's more
convenient.  You also might want to limit key tracking to occur only during
certain events/states of your app so you're not needlessly polling key
states.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX Design




Recently, Richmond wrote:

>   On 10/11/2010 02:06 PM, Colin Holgate wrote:
>> This might give you an idea:
>> 
>> on checkkeys
>> send checkkeys to me in 100 milliseconds
>> put shiftkey()
>> end checkkeys
>> 
>> 
>> 
>> _
> 
> This:
> 
> on rawKeyDown
> if shiftkey() is down then
>put "DOWN" into fld "fSHIFT"
> end if
> end rawKeyDown
> 
> on rawKeyUp
> if shiftkey() is up then
>put "UP" into fld "fSHIFT"
>end if
> end rawKeyUp
> 
> in the card script
> 
> works on Linux, but NOT on Mac because pressing the SHIFT key
> does not send a rawKeyDown on a Mac . . .
> 
> One can trap for rawKeyDown for a "normal" key and then if that key is down
> do something like this:
> 
> if the shiftKey is down then
>do blah, blah, blah
> end if
> 
> what I cannot work out how to do is find out if the SHIFT key is down
> without
> having to plonk my fat fingers on some other key as well.
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: SHIFTy thoughts

2010-10-11 Thread Colin Holgate
This part:

if the shiftkey and not shiftisdown then
   UserReleasedShiftKey
 end if

should have been:

if not the shiftkey and shiftisdown then
   UserReleasedShiftKey
 end if

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: SHIFTy thoughts

2010-10-11 Thread Colin Holgate

On Oct 11, 2010, at 12:49 PM, Richmond wrote:

> what I cannot work out how to do is find out if the SHIFT key is down without
> having to plonk my fat fingers on some other key as well.


You said this just now, with my solution that works still copied in the top of 
your message. Take another look:

> on checkkeys
>send checkkeys to me in 100 milliseconds
>put shiftkey()
> end checkkeys

You would call checkkeys at the start of your card that you want to be seeing 
shift being pressed, and from then on it would look after itself. Like this 
maybe:

global shiftisdown

on opencard
  put the shiftkey is down into shiftisdown
  checkkeys
end opencard

on checkkeys
  if the shiftkey and not shiftisdown then
   UserPressedShiftKey
  else
 if the shiftkey and not shiftisdown then
UserReleasedShiftKey
  end if
   end if
  send checkkeys to me in 100 milliseconds
end

on UserPressedShiftKey
  put true into shiftisdown
 --do whatever you want to be done when the shift is pressed
end UserPressedShiftKey

on UserReleasedShiftKey
  put false into shiftisdown
 --do whatever you want to be done when the shift is released
end UserReleasedShiftKey


The above script would require that the user held the shift down for at least a 
tenth of a second for it to be seen. If you need quicker reaction than that, 
set the send delay to a shorter value.


  
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: SHIFTy thoughts

2010-10-11 Thread Richmond

 On 10/11/2010 02:06 PM, Colin Holgate wrote:

This might give you an idea:

on checkkeys
send checkkeys to me in 100 milliseconds
put shiftkey()
end checkkeys



_


This:

on rawKeyDown
   if shiftkey() is down then
  put "DOWN" into fld "fSHIFT"
   end if
end rawKeyDown

on rawKeyUp
   if shiftkey() is up then
  put "UP" into fld "fSHIFT"
  end if
end rawKeyUp

in the card script

works on Linux, but NOT on Mac because pressing the SHIFT key
does not send a rawKeyDown on a Mac . . .

One can trap for rawKeyDown for a "normal" key and then if that key is down
do something like this:

if the shiftKey is down then
  do blah, blah, blah
end if

what I cannot work out how to do is find out if the SHIFT key is down 
without

having to plonk my fat fingers on some other key as well.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: SHIFTy thoughts

2010-10-11 Thread J. Landman Gay

On 10/11/10 6:27 AM, Len Morgan wrote:


I think what Richmond was after was a message that get's sent when he
presses the shift key, not detecting when it's down. The only way that
comes to mind would be a front script that captured the keydown/keyup or
rawkeys messages, check for the shift key state then fired a message to
a handler of your choosing.


On OS X, at least, no key messages are sent by the OS when the shift key 
is depressed. The OS does allow you to check its state if you 
specifically ask, which is why the function works, but you aren't 
notified automatically by the OS each time it goes down. That's why 
LiveCode can't send any system messages about it.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: SHIFTy thoughts

2010-10-11 Thread Len Morgan

 On 10/11/2010 6:16 AM, roger.e.el...@sealedair.com wrote:

Richmond wroe:

I would love to be able to trap when a modifier key is down like this:

on shiftKeyDown
 do blah, blah, blah
end shiftKeyDown

but it seems that that is not possible in LievCode, unless, of course,
I'm missing something . . .

Richmond.

I can only determine its state within an if-then statement.  Perhaps try a
rawKey handler.

on mouseUp
if the shiftKey is down then
   answer "DOWN, the shiftKey is."
else
   answer "UP, the shiftKey is."
end if
end mouseUp

~Roger
I think what Richmond was after was a message that get's sent when he 
presses the shift key, not detecting when it's down.  The only way that 
comes to mind would be a front script that captured the keydown/keyup or 
rawkeys messages, check for the shift key state then fired a message to 
a handler of your choosing.


You'd have to pass on the original event in either case and make sure 
you didn't set up some sort of infinite loop though.


len
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: SHIFTy thoughts

2010-10-11 Thread Roger . E . Eller
Richmond wroe:
> I would love to be able to trap when a modifier key is down like this:
>
> on shiftKeyDown
> do blah, blah, blah
> end shiftKeyDown
>
> but it seems that that is not possible in LievCode, unless, of course,
> I'm missing something . . .
>
> Richmond.

I can only determine its state within an if-then statement.  Perhaps try a
rawKey handler.

on mouseUp
   if the shiftKey is down then
  answer "DOWN, the shiftKey is."
   else
  answer "UP, the shiftKey is."
   end if
end mouseUp

~Roger


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: SHIFTy thoughts

2010-10-11 Thread Colin Holgate
This might give you an idea:

on checkkeys
   send checkkeys to me in 100 milliseconds
   put shiftkey()
end checkkeys



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution