realbasic-nug
[Top] [All Lists]

Toggle checkbox using return key

To: "REALbasic Network Users Group" <realbasic-nug at lists dot realsoftware dot com>
Subject: Toggle checkbox using return key
From: "Rob" <rb at down2business dot com>
Date: Thu, 30 Aug 2007 18:08:12 -0400
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
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

A quick way to see it is;

 if key = chr(13) then
    MsgBox "Return"
  End If

Thanks,
Rob

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

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


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