|
of_message
|
|
Full name
|
pfc_n_cst_error.of_message
|
Access
|
public
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
public function integer of_message(string,string[],string)
|
Name
|
Datatype
|
lb_log
|
Boolean
|
lb_notify
|
Boolean
|
li_rc
|
Integer
|
ll_row
|
Long
|
ll_rowcount
|
Long
|
ls_errorpass
|
n_cst_errorattrib
|
public function integer of_message (string as_msgid, string as_msgparms[], string as_overridetitle);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_Message
//
// Access: public
//
// Arguments:
// as_msgid Error number to look up and retrieve message "look".
// as_msgparms Array containing the substitution parameters.
// as_overridetitle Title string to override the Pre-defined title.
// This is useful when sharing one pre-defined message
// that needs to have different titles (for example, the
// title could be application or window dependent.)
//
// Returns: integer
// the button the user selected
// -1 for failure
//
// Description: Process passed in error index and display message box.
// *Note: Any time this function is called, a window will popup even
// if errors are encountered.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0 Initial version
// 5.0.02 Added user value to structure information.
// 5.0.04 Corrected ll_rowcount datatype from integer to long.
// 5.0.04 Removed unwanted beep(1) call.
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1996-1997 Sybase, Inc. and its subsidiaries. All rights reserved.
// Any distribution of the PowerBuilder Foundation Classes (PFC)
// source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////
Integer li_rc
Long ll_rowcount
Long ll_row
Boolean lb_log=False
Boolean lb_notify=False
// Clear and Initialize instance structure.
n_cst_errorattrib ls_errorpass
inv_errorpass = ls_errorpass
// Initialize the user
inv_errorpass.is_user = is_user
// Initialize the override title.
inv_errorpass.is_title = as_overridetitle
// Default values in case an error is encountered.
// Give the User all the buttons, in case he/she knows which one to click.
inv_errorpass.ie_buttonstyle = YesNoCancel!
inv_errorpass.ie_icon = StopSign!
// Check argument
If Len(Trim(as_msgid)) >0 Then
If IsNull(ids_messages) Or Not IsValid(ids_messages) Then
// The predefined functionality is not yet available.
inv_errorpass.is_text = 'Predefined Message "'+as_msgid+'" not found.~r~n ~r~n' +&
'The Predefined Messages not found.'
Else
// Get number of rows in datastore
ll_rowcount = ids_messages.RowCount()
// Find index.
ll_row = ids_messages.Find("Lower(msgid) = '"+ Lower(as_msgid) +"'", 1, ll_rowcount)
If ll_row > 0 Then
// Entry was found. Load structure.
If Len(Trim(as_overridetitle))=0 Then
// Only get the predefined title, the title was not overriden.
inv_errorpass.is_title = ids_messages.Object.msgtitle[ll_row]
End If
// Get the text and perform any needed conversions.
inv_errorpass.is_text = ids_messages.Object.msgtext[ll_row]
inv_errorpass.is_text = inv_string.of_GlobalReplace (inv_errorpass.is_text, '~~r', '~r')
inv_errorpass.is_text = inv_string.of_GlobalReplace (inv_errorpass.is_text, '~~n', '~n')
inv_errorpass.is_text = inv_string.of_GlobalReplace (inv_errorpass.is_text, '~~t', '~t')
// Get the rest of the information.
li_rc = inv_conversion.of_icon(ids_messages.Object.msgicon[ll_row], inv_errorpass.ie_icon )
If li_rc <> 1 Then inv_errorpass.ie_icon = StopSign!
li_rc = inv_conversion.of_button(ids_messages.Object.msgbutton[ll_row], inv_errorpass.ie_buttonstyle )
If li_rc <> 1 Then inv_errorpass.ie_buttonstyle = OK!
inv_errorpass.ii_default = ids_messages.Object.msgdefaultbutton[ll_row]
inv_errorpass.ii_severity = ids_messages.Object.msgseverity[ll_row]
inv_errorpass.ib_print = (Lower(ids_messages.Object.msgprint[ll_row]) = 'y')
inv_errorpass.ib_userinput = (Lower(ids_messages.Object.msguserinput[ll_row]) = 'y')
Else
// Entry was not found.
inv_errorpass.is_text = 'Predefined Message "'+as_msgid+'" not found.'
End If
If UpperBound (as_msgparms) > 0 Then
// Replace %s with passed in parms in the error text returned in the
// instance structure.
li_rc = of_ProcessMessageSubstitution(as_msgparms)
End If
End If
End If
// Call function to Process Message.
Return of_ProcessMessage()
end function