Absent Member.
Absent Member.
1787 views

Focusing in on a Textbox?

I have a textbox defined called PER-CODE.

PER-CODE has properties of TabIndex = 0, indicating that the field SHOULD be the first field I enter on the screen.

Despite this I must press the TAB key once before my field is highlighted and I'm able to enter data.

Have tried INVOKE PER-Code::Focus() prior to screen launch but this makes no difference.

How do I make it so that the field PER-CODE takes input straight away once the form loads?

0 Likes
3 Replies
Micro Focus Expert
Micro Focus Expert

What control is the focus being set to?

f you select View-->Tab Order from the IDE menu it will show you the current tab order on the form.

In order to use focus to change the main focus you should place it in the Form_Activated event.

Example:

method-id Form1_Activated final private.

procedure division using by value sender as object e as type System.EventArgs.

      invoke textBox3::Focus

end method.

0 Likes
Absent Member.
Absent Member.

Thanks for that.

Just to confirm something...

When I click on the View->Tab Order on the form I see all my fields with several showing as 0.0.0.

I'm using a tabbed screen area so am I to assume that the FIRST 0 indicates the form level, the SECOND 0 indicates the TAB sequence and the THIRD 0 indicates the FIELD level.

Am I then to assume that the only 0.0.0 field that would be a VALID tab stop is where the TAB STOP property is set to TRUE?

0 Likes
Micro Focus Expert
Micro Focus Expert

The Tab Order is shown by priority number where the leftmost digit is the main TabIndex of the container itself and subsequent numbers are the tabindex within the container, etc.

You can change the tab order using this view Tab Order screen by clicking each control in the order that you would like them to appear in the tab order.

Example:

If you have a form which contains the following:

textbox1 =1

panel1 = 0

  textbox2 = 0.0

  textbox3 = 0.2

  panel2 = 0.1

      textbox4 = 0.1.0

button1 = 2

The taborder at run-time would be:

textbox2

textbox4

textbox3

textbox1

button1

If any of these controls had tabstop=false set then they would be ignored.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.