There are two ways to call a secondary page from
main page
1) Setting Pushbutton properties
Note:
every pushbutton should be associated with field of that page record.
2)
Domodal function:
The DoModal function displays a secondary page. Secondary pages
are modal, meaning that the user must dismiss the secondary page before
continuing work in the page from which the secondary page was called. To use Domodal
function set the Destination as ‘PeopleCodeCommand’ in Pushbutton properties as
shown below.
Note : Domodal is also used to call
Standard page. Can use more than one
Domodal function in single event peoplecode to call more than one secondary
page.
Syntax
DoModal(PAGE.pagename, title, xpos, ypos, [level,
scrollpath, target_row])
Any variable declared as a Component
variable will still be defined after using a DoModal function.
DoModal should not be
used in the following peoplecode events:
Saveprechange
Savepostchange
Workflow
Rowselect
Any PeopleCode event
that fires as a result of a ScrollSelect, ScrollSelectNew, RowScrollSelect or
RowScrollSelectNew function call.
Returns
Returns a number that indicates how
the secondary page was terminated. A secondary page can be terminated by the
user clicking a built-in OK or Cancel button, or by a call to the
EndModal function in a PeopleCode program. In either case, the return
value of DoModal is one of the following:
- 1 if the user clicked OK in the secondary page, or if 1 was passed in the EndModal function call that terminated the secondary page.
- 0 if the user clicked Cancel in the secondary page, or if 0 was passed in the EndModal function call that terminated the secondary page.
Example :
DoModal(PAGE.EDUCATION_DTL,
MsgGetText(1000, 167, "EducationDetails - %1", EDUCATN.DEGREE), - 1,
- 1, 1, RECORD.EDUCATN, CurrentRowNumber());
EndModal
:
The EndModal function closes a
currently open secondary page. It is required only for secondary pages that do
not have OK and Cancel buttons. If the secondary page has OK and
Cancel buttons, then the function for exiting the page is built in and no
PeopleCode is required.
Example :
The following statement acts as an
OK button:
EndModal(1);
The following statement acts as a
Cancel button:
EndModal(0);
IsModal :
IsModal returns True if executed from PeopleCode running in a modal
secondary page and False if executed elsewhere. This function is useful in separating
secondary page-specific logic from general PeopleCode logic.
Example
If Not IsModal() Or
Not (%Page = PAGE.PAY_OL_REV_RUNCTL Or %Page = PAGE.PAY_OL_RE_ASSGN_C Or %Page = PAGE.PAY_OL_RE_ASSGN_S) Then
Not (%Page = PAGE.PAY_OL_REV_RUNCTL Or %Page = PAGE.PAY_OL_RE_ASSGN_C Or %Page = PAGE.PAY_OL_RE_ASSGN_S) Then
Evaluate
COUNTRY
When = "USA"
When = "CAN"
If Not AllOrNone(ADDRESS1, CITY, STATE) Then
Warning MsgGet(1000, 5,"Address should consist of at least Street (Line 1), City, State, and Country.")
End-If;
Break;
When = "USA"
When = "CAN"
If Not AllOrNone(ADDRESS1, CITY, STATE) Then
Warning MsgGet(1000, 5,"Address should consist of at least Street (Line 1), City, State, and Country.")
End-If;
Break;
When-Other;
If Not AllOrNone(ADDRESS1, CITY, COUNTRY) Then
Warning MsgGet(1000, 6, "Address should consist of at least Street (Line 1), City, and Country.")
End-If;
End-Evaluate;
End-If;
If Not AllOrNone(ADDRESS1, CITY, COUNTRY) Then
Warning MsgGet(1000, 6, "Address should consist of at least Street (Line 1), City, and Country.")
End-If;
End-Evaluate;
End-If;
wow that was a great synopsis
ReplyDeleteHey Hi Ismail,
ReplyDeletethat was nice context, one doubt what if i need to disable only OK/Cancel Button on secondary page without using our customized buttons.