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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script Language: Active Field on Screen

Status
Not open for further replies.

Calator

Programmer
Feb 12, 2001
262
AU
Hi,

Does the Scripting Language (Mintscript or Smartgui script) have a command that can be used to designate the "active" field on the screen?

The background to may question is: on MSM14SA there are 2 stock code fields and I need the script to link to an external MS Word document that has information on the stock code designated by the active field
 

MINT and SmartGUI Mims Scripting

I can't remember ever writing a script which tested cursor position (generally the error message number was specific to an individual field only which was sufficient), but the doco says you can test a MIMS field for cursor positioning or field protection.
This would require a long-winded approach to test each field on the screen to find out which field is active.

In the following example:

Code:
SET 'CURF1=' @FIELD1 [C]

If the cursor is in the field @FIELD1 the variable CURF1 is set to '!'.

Also (if you are interested)

Code:
SET 'PROF1=' @FIELD1 [P]

If the field @FIELD1 is protected then the variable PROF1 is set to '#'.



Mincom Connector

When using the MSO interface of Mincom connector, you can reference the ActiveField property.

In the following example:

Code:
sFldName = Trim$(oMimsx.Screen.MSO.ActiveField.Name)
sFldValue = Trim$(oMimsx.Screen.MSO.ActiveField.Value)

sFldName will return the Name of the field which is Active
sFldValue will return the Value of the field which is Active



MSQ000 Scripting (Ellipse VB Scripts)

I haven't yet written an Ellipse VB Script needing this functionality (mostly doing Mincom Connector scripting), but the doco says you can get the Active Field using GetCursor.

In the following example:

Code:
sFldName = msq000.GetCursor

sFldName will return the Name of the field which is Active

 
Thank you for your valuable posting
I had to code for SmartGui, and although I dug up the current field concept from the doco, it did not seem to work ok, ie simply by placing the cursor on the field would not recognise it as the the current field, that appeared to happen only after <enter> was pressed.
I would say 'appeared' because my code might be buggy, or maybe composed with bugs in my user exit on the back end code. I gave that solution up, and replaced with "menu" where the user actually selects the required stock-code from a pop-up list of the two fields on the screen, which is lame but it works.

Checking on the 'active' field would have been more elegant and it was not at all long-winded as you say, because we were only interested in checking 2 fields on the screen. Here is my code

SET 'CUR_PROT1=' @PART_NO1I1[CP]
SET 'CUR_PROT2=' @PART_NO1I2[CP]
SET 'DOCNO1=' @PART_NO1I1
SET 'DOCNO2=' @PART_NO1I2
PERFORM MSM14SA_STOCK2
PERFORM MSM14SA_STOCK1

SUBROUTINE MSM14SA_STOCK1
/*example using the concept of 'current field'
/*If the cursor is in the field @PART_NO1I1 the variable CUR_PROT is set to ‘!’.
/*If the field is protected, the variable CUR_PROT is set to ‘#’.
/* Abort subroutine if cursor is not in field or if field is empty:
ABORT IF NOT ( CUR_PROT1 = '!' )
ABORT IF ( DOCNO1 = '' )
/* else system call to display the material safety data sheet
SYSTEM 'WINEXEC SHOWMAXIMIZED C:\PROGRA~1\INTERN~1\IEXPLORE.EXE http:\\server-here\mims41\doclink\doclink.asp?doctype=3&docno='DOCNO1
RETURN
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top