Solved

ActiveForms, Tabbing, and Backspace

Posted on 1998-06-05
3
537 Views
Last Modified: 2006-11-17
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
Comment
Question by:descikartus
3 Comments
 
LVL 6

Expert Comment

by:edey
ID: 1350882
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
 

Author Comment

by:descikartus
ID: 1350883
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
 

Accepted Solution

by:
belgianbasman earned 100 total points
ID: 1350884
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now