On Aug 30, 2007, at 6:08 PM, Rob wrote:
> Hi,
> I'm trying to allow users to toggle a checkbox value by tabbing to the
> checkbox and hitting the return key. The problem I'm having is that
> chr(13)
> seems to fire twice, once when the user hits the key, and again
> when the
> value is changed. Is there another way to accomplish this?
> Here's the code I'm using in the KeyDown event:
>
> if key = chr(13) then
> if me.Value=False then
> me.Value=True
> else
> me.Value=False
> end
> End If
First, you could rewrite this as follows.
if (key = Chr(13)) then
me.Value = not me.Value
end if
I'm not sure what you mean by "chr(13) seems to fire twice", but you
might try returning true from the KeyDown event handler. Since
Checkboxes don't get KeyDown events in Mac OS, I'm just guessing.
If this does not work, then you can write a Checkbox subclass in
which the Action event handler is called exactly when you want it to
be called.
Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|