Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Questions regarding setting of tabbing order

Status
Not open for further replies.

CHeighlund

Programmer
Jun 11, 2007
163
US
I've got a program I've been working on which I've been requested to 'neaten up' tabbing on.

The program was built to hold multiple separate portions of what was once a paper form. The way I built it, to accomodate what I thought I needed, is giving me a few problems trying to determine how to set up my tab order.

Layout is as follows:
Code:
Top segment - single information textbox.

Six swappable 'Middle' segments, five of one type (call it Ti) and one of another (Tii).

Layout - 
Middle segment Ti - six panels
Panel 1 - single checkbox
Panels 2,3,4 - checklist box and (sometimes) text box. (Left/Middle/Right layout - tabbing should be in that order)
Panel 5 - Either blank, an additional checklist box, or three text boxes.
Panel 6 - Single Memo field.

Middle segment Tii - 
Two main panels-
Panel 1 - Additional panel with three read-only text boxes (never supposed to gain focus) and a semi-locked radiogroup component.  (Again, never supposed to take focus.  Set by code elsewhere.)
Panel 2 - Memo field.

Right segment - contains two buttons.  Button.onclick for both used to swap back and forth between visible middle segments.

Bottom segment - contains two buttons.

Tabbing sequence requests -
I can handle the tabbing between items inside any given segment; where I really think I need help is setting up the appropriate tabbing between segments.

I need to be able to tab from any Middle segment to Right segment.
Need to be able to tab from right segment to bottom or middle segment, based on which middle segment is showing. (From right to middle for any Ti, from right to bottom for Tii).

Does anyone have any suggestions as to what the appropriate way to set up my tab ordering might be, or is this going to be something I simply have to figure out myself?
 
You can also bypass the standard tab order yourself in the Keypress event. Then you can use the business logic as required.
 
How do I identify the tab (and shift) press? The On Keypress event doesn't seem to react to my hitting the tab key (or the shift key, for reverse tabbing). At the moment, I've got a dummy project up, which is supposed to change the color(s) of a set of panels on keypress = #s 9, 11, 14, 15. (According to an ascii chart I found, horizontal tab, vertical tab, shift out, shift in respectively.) None of them triggers no matter how often I hit the keys. Any suggestions as to what I'm doing wrong here?
 
Something like:

if Key = #9 then
begin
if <business logic> then
begin
texbox.setfocus;
Key := #0;
end;
end;
 
I did attempt that originally; the actual 'if Key = #9' portion never seemed to register, though. I'm having the same problems now with the KeyUp/KeyDown events and the VK_TAB virtual key; it simply seems like the program isn't registering when I hit the tab key; the components simply jump away anyway.
 
Original project: As far as I can tell, CLX. The includes list at the top includes a lot of items beginning with Q. (QControls, QForms, etc...)

Dummy Test Project: Presumably in VCL - I just started a new project.

Code sample "if (Key = #9) then" didn't appear to work in either one.
 
Rats!

I figured I could do a switch on some existing code but it doesn't work as you've found.

I found a couple of references but it doesn't look like a pretty chore. One way is to trap the tab key at the application level and then determine which field has the current focus and move it. You could keep track of the field the user is currently in when they enter the field.

The other is equally inelegant:

Sorry... :-(
 
I already took a look at that one, but thanks.

I'm almost there - I discovered that making every single tabstop property on the page 'false' means the KeyDown event will recognize the tab key, at least. The problem is, I'm not sure what it's recognizing the key as, because it's failing an (if Key = VK_TAB then) check. For that matter, it's blanketly failing a series of checks done on every Virtual Key VK_* code. Yes, I actually took the time to code that in and check on it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top