Highlighted
Respected Contributor.
Respected Contributor.
450 views

Set cursor position in Dialog System

I have an alphanumeric entry field which I am populating before displaying my dialog screen and would like to set the cursor position at the end. For example, if I populate an entry field in my Visual Cobol program with the word "TESTING"  prior to displaying my screen, I would like the blinking cursor to appear at the end of the word (which would be after the letter "G") once my screen displays.  I do not know how to do this.

 

Thanks in advanced for your help.

0 Likes
2 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Set cursor position in Dialog System

I don't think you can do this with a normal entry field except by turning autoswipe on but you can when using the Text Entry control which is found under the Programmable controls tab of Dialog System. These are significantly more difficult to use however as it requires a control program and knowledge of both the native OO programming model and the use of the GUI Class Library.

There is an example of using this control in the Samples Browser. Select Show Dialog System only from the drop down and then highlight Dialog System Classic and open up the project for Dialog System Text Entry Control.

You can position the cursor to the end of the field by invoking the methods getText to return the current contents and then counting the characters and then positioning the cursor using the method setSelectionArea.

FYI, Dialog System is a very old technology that was available with Net Express. It was added to Visual COBOL only for compatibility with existing applications. Doing new development from scratch with Dialog System is not recommended. You should look at some of the managed code solutions available to you such as Windows Forms or WPF.

Thanks.
0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

RE: Set cursor position in Dialog System

Thanks for that information.
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.