Popup in Windows subfile

1400 pts.
Tags:
AS/400
Windows subfile
Hi, I want to pop up my window when I press F4 (help) in a particular field. My problem is this...when I press F4 anywhere, a popup window displayed. Thanks in advance!

Answer Wiki

Thanks. We'll let you know when a new response is added.

Use *DFT as the 1st parameter in the WINDOW Keyword,
<pre>
WINDOW (Window) keyword for display files
Use this record-level keyword to specify that the record format you are defining will be displayed using a
window. A window is information that overlays part of the display. A window is usually smaller than the
actual work station display, and can be positioned anywhere on the display.
The WINDOW keyword has two formats that can be used. These formats do the following:
v Define a window by specifying the location and size of a window; this is known as a window definition
record.
v Refer to a record format name where the window location and size have been defined; this is known as
a window reference record.
The format for the keyword is one of the following:
Display Files, WDWTITLE
244 OS/400 DDS Reference: Display Files V5R1
WINDOW(start-line | &start-line-field start-position
| &start-position-field window-lines window-positions
[*MSGLIN | *NOMSGLIN])
[*RSTCSR | *NORSTCSR])
or
WINDOW(*DFT window-lines window-position
[*MSGLIN | *NOMSGLIN]
[*RSTCSR | *NORSTCSR])
Specify this format of the WINDOW keyword to define a window. The record format you are defining is
displayed in this window. Up to 12 windows can be shown on the display at one time. You can define more
than 12 windows in DDS, but only 12 can be displayed at the same time. However, if USRRSTDSP is
specified, the number of windows is unlimited. All fields defined in this record must fit within the window.
The parameters specify:
v The number or the name of a field containing the number of the line that is to contain the upper-left
corner of the window border. If a field name is specified, the field must exist in the record format and
the field must be defined as a signed numeric (data type S) and program-to-system (usage P) field with
length no greater than 3.
v The number or the name of a field containing the number of the position that is to contain the upper-left
corner of the window border. If a field name is specified, the field must exist in the record format and
the field must be defined as a signed numeric (data type S) and program-to-system (usage P) field with
length no greater than 3.
v The number of window-lines within the window. The window-lines can be no more than the available
lines for the display size minus 2. This is because the upper and lower window borders each occupy
one line.
The last window-line in a window is used as the message line and cannot contain any fields. For
example, if a WINDOW keyword is coded that specifies 10 window-lines for the window, only 9 of those
lines can contain fields; the 10th line is the message line.
v The number of window-positions within the window. The window-positions can be no more than the
available positions for the display size minus 4. This is because both right and left borders need an
attribute byte inside the window. An attribute byte exists between the border character and the available
window positions. For DBCS-capable windows, the system may need an additional 2 bytes on each
side of the window for a shift-out character and shift-in character for any underlying DBCS fields.
v The MSGLIN parameter specifies if a window contains a message line. If this parameter is not
specified, the default is *MSGLIN. *NOMSGLIN moves the message out of the window and places it at
the bottom of the display or where the MSGLOC keyword defines the location. The last usable line in
the window is reserved for error messages; no records are displayed there. If the error message is
longer than the line, it is truncated to fit.
v The *RSTCSR parameter specifies if the user should be allowed limited function when the cursor is
outside of the window. When *NORSTCSR is specified and the cursor is outside of the window, the user
will be allowed to press a function key and have it function as if the cursor were within the window.
When the user specifies *RSTCSR on a controller that supports enhanced interface for
nonprogrammable workstations, the user will be able to move the cursor out of the window (except with
a mouse). For other workstations, when the user attempts to press a function key while the cursor is
outside of the window, the user will receive a beep and the cursor will be placed inside the window.
Control will not be returned to the application. *RSTCSR is the default.
The special value, *DFT, specified in place of the start-line and start-position parameters, indicates that the
system will determine the start line and start position of the window. The window is positioned relative to
the cursor location, similar to application help windows with variable starting locations. More information on
the rules the system uses to position the window can be found in the Application Display Programming
book.
The second format for the WINDOW keyword is:
Display Files, WINDOW
Chapter 2. DDS keyword entries for display files (positions 45 through 80) 245
WINDOW(record-format-name)
Specify this format of the WINDOW keyword to display the record format you are defining in a window that
is defined on another record format.
The parameter specifies the record format name that has the window attributes specified. The record
format that uses this parameter is displayed in the window defined on the referenced record.
The field locations specified within a record format with the WINDOW keyword are relative to the first
usable window location in the upper-left corner of the window. The first usable window location is on the
first line below the upper border and two positions to the right of the left border (an ending attribute byte
occupies the first byte to the right of the border).
When a window is displayed, any records currently on the display are suspended if USRRSTDSP is not
specified. The suspended records may be visible around the sides of the window. Input is allowed only
within the active window. To remove the window from the display, a record can be written to an underlying
window or a non-window record must be overlaid on the display.
The WINDOW keyword is not allowed on a record format that has any one of the following keywords
specified:
ALWROL
ASSUME
MNUBAR
PULLDOWN
SFL
USRDFN
Note: The WINDOW keyword is allowed on a record with the SFLCTL keyword. This allows subfiles to be
displayed within a window.
WINDOW cannot be specified for the record format specified by the PASSRCD keyword.
The ERRSFL keyword is ignored for records that have the WINDOW keyword specified.
The MSGLOC keyword is ignored for records that have the WINDOW keyword specified, unless
NOMSGLIN is specified.
If a record format has both a WINDOW and WDWBORDER keyword specified, specify the start-line,
start-position, window-lines, and window-positions parameters on the WINDOW keyword. The WINDOW
keyword should not specify the record-format-name parameter.
Option indicators are not valid for this keyword. However, display size condition names can be used.
Example 1:
The following example shows how to specify the WINDOW keyword to define a window.
|…+….1….+….2….+….3….+….4….+….5….+….6….+….7….+….8
A R WINDOW1 WINDOW(4 20 9 30 *NORSTCSR)
A FIELD1 8A B 5 10
A FIELD2 10A B 6 10
A R WINDOW2 WINDOW(*DFT 9 30 *NOMSGLIN)
A
When the WINDOW1 record is displayed, the upper-left corner of the window border is on line 4 position
20 of the display. The lower-right corner of the border is located 10 lines lower than the upper border and
33 positions to the right of the left border.
v Lower border line = upper border line + window-lines + 1
v Right border position = left border position + window-positions + 3
Display Files, WINDOW
246 OS/400 DDS Reference: Display Files V5R1
The FIELD1 field starts 2 lines lower than the upper border and 11 positions (the ending attribute byte for
the border character has been taken into account) to the right of the left border character (line 6, position
31 on the display).
v Actual field line = upper border line + line number of field
v Actual field position = left border position + position of field + 1
The FIELD2 field starts 6 lines lower than the upper border and 11 positions to the right of the left border
(line 10, position 31 on the display).
If the cursor is moved outside of the window, the function keys will remain active.
When the WINDOW 2 record is displayed, the upper-left corner of the window border is at the cursor
position during run time. The message line does not appear inside the window, it appears at the bottom of
the display.
If the cursor is moved outside of the window, the function keys are inactive. If the user presses a function
key, they will receive a beep and the cursor will be place within the window.
Example 2:
The following example shows how to use the WINDOW keyword to display multiple records in the same
window.
|…+….1….+….2….+….3….+….4….+….5….+….6….+….7….+….8
A R WINDOW1 WINDOW(&LINE &POS 9 30)
A USERID 8A O 2 10
A LINE 2S 0P
A POS 3S 0P
A
A R RECORD1 WINDOW(WINDOW1)
A OVERLAY
A FIELD1 5A B 7 2
A FIELD2 20A B 8 5
A
A R RECORD2 WINDOW(WINDOW1)
A FIELD3 10A B 2 2
A FIELD4 8A B 8 5
A FIELD4 8A B 8 5
A
When the WINDOW1 record is displayed, the upper-left corner of the border will be at the line and position
numbers specified by the LINE and POS fields, respectively. The lower-right corner of the border is located
10 lines lower than the upper border and 33 positions to the right of the left border.
The USERID field starts 2 lines lower than the upper border and 11 positions to the right of the left border
character.
If RECORD1 (from the previous example) is displayed, it is placed within WINDOW1. Its fields are
positioned with respect to the upper-left corner of the window. The fields from record WINDOW1 which
were on the display remain because the OVERLAY keyword was used on RECORD1 and the two records
do not overlap. For more information on the OVERLAY keyword, see the “OVERLAY (Overlay) keyword for
display files” on page 165.
If RECORD2 (from the previous example) is displayed, it is also placed within WINDOW1. Its fields are
positioned with respect to the upper-left corner of the window. Because the OVERLAY keyword was not
used, the fields from records WINDOW1 and RECORD1 are removed from the window.
Example 3:
Display Files, WINDOW
Chapter 2. DDS keyword entries for display files (positions 45 through 80) 247
The following example shows how to use the WINDOW keyword with a subfile.
|…+….1….+….2….+….3….+….4….+….5….+….6….+….7….+….8
A R SFLDATA SFL
A NAME 20A B 4 5
A RANK 10A B 4 27
A SERIAL 8A B 4 38
A
A R WINDOW1 SFLCTL(SFLDATA)
A WINDOW(8 25 10 50)
A SFLPAG(4)
A SFLSIZ(17)
A SFLDSP
A SFLDSPCTL
A 2 5’Full Name’
A 2 27’Rank’
A 2 38’Serial Nbr’
A
When the WINDOW1 subfile control record is displayed, it and the subfile are displayed in a window. The
upper-left corner of the window border is at line 8, position 25 on the display. The lower-right corner of the
border is located on line 19, position 78.
The fields from both the subfile record and subfile control record are located with respect to the first usable
window position in the upper-left corner of the window. For example, the NAME field in the SFLDATA
record starts on the 4th window line and the 5th window position, which is the same as the 12th line on
the display and the 31st position on the display.</pre>

Discuss This Question: 8  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    when i press F4 any where popup window displayed To control when the window appears, your program must check the cursor to see what field it was in. If you are programming in RPG, after F4 is pressed, your program will check the INFDS of the display file to determine where the cursor was. The INFDS has a field that holds the binary values of the line and column of the screen location of the cursor. You need to program to test the line and column values to see if it fits within the position of any fields that you want your window to handle. Don't display the window if the cursor location is not what you want. Review Figure 36. Example of Coding an INFDS with Display Specific Feedback Information on the INFDS Device Specific Feedback Examples page in the Information Center. Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    There is another option for help text. Using Panel Groups.
    51,365 pointsBadges:
    report
  • TomLiotta
    I missed that the F4 was being tagged as "(help)". That makes it more confusing because a 'help' window perhaps should pop-up no matter where the cursor is on the screen. It might just have different text for different screen locations. And using a window format for 'help' would only seem useful if the text is dynamic, which seems unusual for 'help' text. That's separate from using F4 as a 'help' key in the first place. Personally, I agree with the thought of panel groups for 'help'. I haven't seen much reason for anything else they first became available. Tom
    125,585 pointsBadges:
    report
  • 9783444184
    hi thanks for your reply but i am not getting...... my problem is that there is field like __________+ when i press f4 in this field the window should be display
    1,400 pointsBadges:
    report
  • CharlieBrowne
    Whave you defined F4 in the DDS? Do you want to display different pop ups depending on where the cursor is?
    41,430 pointsBadges:
    report
  • philpl1jb
    Tom's right (only when he agrees with me!) this should be panel groups and yes, panel groups include field level help. For your direction, you may want to look at the display record level keyword RTNCSRLOC, as in: A RTNCSRLOC(&CSRFMT &CSRFLD) A CSRFMT 10A H A CSRFLD 10A H When your display returns to the program CSRFLD will contain the field name that the cursor was pointing to. Or positions 370 and 371 of the file information data structure contains a binary number which can be decoded into the row and column .. divide the value by 256 to get the row ... the remainder (MVR) is the column What you need is a copy of 'Essentials of Subfile Programming and ...' about 2.50 used plus shipping. Phil
    51,365 pointsBadges:
    report
  • TomLiotta
    If this really is about a Windows Subfile, then it possibly isn't a "help" function but a "prompt" function to display a list of items in a windowed subfile. The user could then select an item from the list and the program would put the selected value in the field in the original screen record. Phil's suggestion for RTNCSRLOC() in your DDS is a good one. It can be easier than using the INFDS, though it needs changes to your DDS. It's well worth learning about. Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    And all of this is discussed with examples in Chapter 6. Phil
    51,365 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following