Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 545
  • Last Modified:

ActiveForms, Tabbing, and Backspace

When I create an ActiveForm in Delphi 3 with more than one windowed control (TEdits, for example), I find that someone viewing the ActiveForm from within IE4 cannot use the tab key to go to the next field or use the backspace key to modify the text they just entered.  IE4 apparently traps the TAB and BackSpace keys, not allowing the edit controls or the ActiveForm to recieve them.  How can I get around this limitation?  Or, rather, what should I do to allow tabbing from control to control and using the backspace key within an ActiveForm while it is viewed within a browser?
0
descikartus
Asked:
descikartus
1 Solution
 
edeyCommented:
Have you tried setting the form's keypreview (I think) prop. to true.  This way you may be able to trap specific keys first.
0
 
descikartusAuthor Commented:
Actually, I'm looking for a way to "enable" the ActiveForm to accept these keys as it would if it were a TForm.  Right now, it appears as if Internet Explorer, for example, is treating the entire ActiveForm as one "control" and so you can only tab to it and then off it, instead of tabbing within it.  I hope that makes sense.
0
 
belgianbasmanCommented:
I think you could "trap" the keyboard input in the OnKeyDown event of the form, and check to see if it is a TAB.

If it is a TAB, use the following function :

function FindNextControl(CurControl: TWinControl;
       GoForward, CheckTabStop, CheckParent: Boolean): TWinControl;

This function returns the control that you want to make the active control after a press of the TAB key.  You need to supply the currently active control as the first parameter, and the three booleans.  The first one specifies wether to go forward or backward. You might want to go backward when SHIFT is pressed down while receiving the TAB key. Check for this with a TShiftState.
If you set the second boolean to true, only those controls that have TabStop property set to true will be used as TabStop points.
If you set the third boolean to true, the function will try to go to the first control that is a child of the currentcontrol.  For instance, when you have two edit-boxes in a groupbox, and a comboBox next to the groupBox, and the groupbox is currently active, pressing TAB with the third boolean on true would cause the first Editbox in the Groupbox to be active.  If it is fase, this would result in the combobox to gain focus.

The most common appearance for this function would then be :

Form.ActiveControl:=Form.FindNextControl(Form.ActiveControl,True,True,True);

Other possibility:

{test for SHIFT being pressed}
{if SHIFT pressed then}
Form.ActiveControl:=Form.FindNextControl(Form.ActiveControl,True,True,True);
{else}
Form.ActiveControl:=Form.FindNextControl(Form.ActiveControl,False,True,True);

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now