tab keys... (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: significant digits?
Next thread: [OFF] Old Apple II Game


Re: REALbasic-NUG Digest #6099   -   Charles Yeomans
  tab keys...   -   Harlan Ribnik
   Re: tab keys...   -   Mr. Weasel Willits
   Re: tab keys...   -   Kevin Ballard
    Re: tab keys...   -   Mr. Weasel Willits
   Re: tab keys...   -   Joel Rosenblum
    Re: tab keys...   -   Mr. Weasel Willits
   Re: tab keys...   -   Mr. Weasel Willits
   Re: tab keys...   -   Joel Rosenblum
    Re: tab keys...   -   Mr. Weasel Willits
   Re: tab keys...   -   Joel Rosenblum

tab keys...
Date: 06.05.02 04:01 (Sun, 5 May 2002 21:01:46 -0600)
From: Harlan Ribnik
I'm trying to make sure that when I hit a tab in one of my editfields,
that the focus moves to the next (e.g. last name to first name to middle
initial to ID and back again)

Using RB 4.0.2
MacOS X 10.1.4

the window has 4 edit fields and one listbox. I have the following code
in the keydown events:

in the editLastName keydown event,
if key = chr(9) then 'check for a tab
editfirstName.setfocus
end if

in the editFirstName keydown event,
if key = chr(9) then
editmI.setfocus
end if

in the editMI keydown event,
if key = chr(9) then
editpatientID.setfocus
end if

in the editPatientID event,
if key = chr(9) then
editlastName.setfocus
end if

The behavior, though, is interesting... The focus is initially in the
editLastName field. When I hit a tab, it moves to the editFirstName
field.
When I hit a tab again, it moves to the editPatientID field and then
back to the editFirstName field.

I don't understand why the focus doesn't go where I tell it to. Can
anybody shed any light on this, how I can get around it, or
generally how I can specify the order in which tabs move from field to
field?

TIA!

Harlan R. Ribnik, M.S., M.D.
Dire Wolf Enterprises, Ltd.
PO Box 628
Cheyenne, WY 82003
<email address removed>

If you would make G-d laugh, make plans.

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: tab keys...
Date: 06.05.02 06:05 (Sun, 05 May 2002 22:05:02 -0700)
From: Mr. Weasel Willits
On 5/5/02 8:01 PM, the NSA intercepted the following message from "Harlan
Ribnik" <<email address removed>>:

> I'm trying to make sure that when I hit a tab in one of my editfields,
> that the focus moves to the next (e.g. last name to first name to middle
> initial to ID and back again)
>
> Using RB 4.0.2
> MacOS X 10.1.4
>
> the window has 4 edit fields and one listbox. I have the following code
> in the keydown events:

May I ask why you are doing this? Unless you have the AllowTabs property of
the field set to true, it is handled automatically by REALbasic.

----------------------- Seth Willits --------------------------
There's a fine line between genius and insanity.
Some tell me I've crossed it. Go figure.
----------------- http://freaksoftware.tripod.com/ -------------------


---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: tab keys...
Date: 06.05.02 20:59 (Mon, 06 May 2002 15:59:11 -0400)
From: Kevin Ballard
On 5/5/02 11:01 PM, "Harlan Ribnik" <<email address removed>> wrote:

> in the editLastName keydown event,
> if key = chr(9) then 'check for a tab
> editfirstName.setfocus
> end if
>
> in the editFirstName keydown event,
> if key = chr(9) then
> editmI.setfocus
> end if
>
> in the editMI keydown event,
> if key = chr(9) then
> editpatientID.setfocus
> end if
>
> in the editPatientID event,
> if key = chr(9) then
> editlastName.setfocus
> end if

You forgot to Return True after each .setfocus call. Since you're not doing
that, RB is moving the focus for you after you change it. But the best way
is to simply change the control order so tabs follow naturally.

Re: tab keys...
Date: 06.05.02 23:42 (Mon, 06 May 2002 15:42:03 -0700)
From: Mr. Weasel Willits
On 5/6/02 12:59 PM, the NSA intercepted the following message from "Kevin
Ballard" <kevin@sb.org>:

> You forgot to Return True after each .setfocus call. Since you're not doing
> that, RB is moving the focus for you after you change it. But the best way
> is to simply change the control order so tabs follow naturally.

Thanks for answering. I got lost on my little thing...

------------------------- Seth Willits ----------------------------
"I have learnt silence from the talkative, toleration from the intolerant,
and kindness from the unkind; yet strange, I am ungrateful to these
teachers."
-- Kahlil Gibran
------------------- http://freaksoftware.tripod.com/ ---------------------



---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: tab keys...
Date: 06.05.02 06:46 (Mon, 6 May 2002 01:46:53 -0400)
From: Joel Rosenblum
>> I'm trying to make sure that when I hit a tab in one of my editfields,
>> that the focus moves to the next (e.g. last name to first name to
>> middle
>> initial to ID and back again)

> May I ask why you are doing this? Unless you have the AllowTabs
> property of
> the field set to true, it is handled automatically by REALbasic.

Well, RB does automatically do the tabbing between fields, but it uses
the control order, rather than the visual position of the fields on the
window. If you want to tab using the visual order, then I've got a class
that'll do just that for you.

http://homepage.mac.com/pyropostal/code/visualtabbingorder.sit

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: tab keys...
Date: 06.05.02 14:04 (Mon, 06 May 2002 06:04:20 -0700)
From: Mr. Weasel Willits
On 5/5/02 10:46 PM, the NSA intercepted the following message from "Joel
Rosenblum" <<email address removed>>:

>>> I'm trying to make sure that when I hit a tab in one of my editfields,
>>> that the focus moves to the next (e.g. last name to first name to
>>> middle
>>> initial to ID and back again)
>
>> May I ask why you are doing this? Unless you have the AllowTabs
>> property of
>> the field set to true, it is handled automatically by REALbasic.
>
> Well, RB does automatically do the tabbing between fields, but it uses
> the control order, rather than the visual position of the fields on the
> window. If you want to tab using the visual order, then I've got a class
> that'll do just that for you.

Why not reorder the controls?


------------------ Seth Willits -------------------
Only two things are infinite, the universe and
human stupidity, and I'm not sure about the former.
-Albert Einstein
-------- http://freaksoftware.tripod.com/ ---------



---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: tab keys...
Date: 06.05.02 06:51 (Sun, 05 May 2002 22:51:05 -0700)
From: Mr. Weasel Willits
On 12/31/69 7:13 PM, the NSA intercepted the following message from "Harlan
Ribnik" <<email address removed>>:

> I'm trying to get the tabs to make the focus follow the fields in some
> sort of logical order. I'm trying to find a way to make sure that my
> data entry clerk will be able to tab in a natural fashion from one field
> to another. I'd be happy if there were some way of specifying the order
> in which the tabs progress along the window. I tried handling the
> keydown event to solve this problem and the results are interesting if
> not logical..

This is exactly what the Control Order dialog is for. Controls at the top of
the list get the focus first.

go to Format -> Control Order

Make the editfields appear from top to bottom in the order the data entry
clerk will enter data in.

Hope this is what you're looking for.

--------------- Seth Willits --------------
Procrastination is the worst of my virtues,
but one that I am associated with the most.
-- Seth Willits
---- http://freaksoftware.tripod.com/ -----


---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: tab keys...
Date: 06.05.02 18:47 (Mon, 6 May 2002 13:47:27 -0400)
From: Joel Rosenblum
>> Well, RB does automatically do the tabbing between fields, but it uses
>> the control order, rather than the visual position of the fields on the
>> window. If you want to tab using the visual order, then I've got a
>> class
>> that'll do just that for you.
>
> Why not reorder the controls?

Some people like to use the control order for controlling the order in
which controls *draw* (layering for example) and thus it becomes
difficult to also use it for the order in which controls receive the
focus.

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: tab keys...
Date: 06.05.02 23:41 (Mon, 06 May 2002 15:41:35 -0700)
From: Mr. Weasel Willits
On 5/6/02 10:47 AM, the NSA intercepted the following message from "Joel
Rosenblum" <<email address removed>>:

>> Why not reorder the controls?
>
> Some people like to use the control order for controlling the order in
> which controls *draw* (layering for example) and thus it becomes
> difficult to also use it for the order in which controls receive the
> focus.

Ahh...

----------------------- Seth Willits --------------------------
"And in the insanity I've found freedom and safety; the freedom of
loneliness and the safety of not being understood, because those who
understand us enslave a part of our being."
-- Kahlil Gibran
----------------- http://freaksoftware.tripod.com/ -------------------


---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: tab keys...
Date: 07.05.02 04:35 (Mon, 6 May 2002 23:35:47 -0400)
From: Joel Rosenblum
>> Some people like to use the control order for controlling the order in
>> which controls *draw* (layering for example) and thus it becomes
>> difficult to also use it for the order in which controls receive the
>> focus.
>
> Ahh...

I missed the most obvious reason though. The control order is only
settable at design time, so if you need a window with changing "forms"
(moving controls around and such) the control order becomes rather
useless - you can't even easily move the controls into the right spots
as specified by the control order, because the order is not readable at
runtime either!

The example project I use to demonstrate the power of the class lets you
drag the fields anywhere in the window (at runtime) and watch as the tab
order magically continues to work as expected. Try *that* using RB's
control order.

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>