this is my proposed n_cst_error.of_processmessage(), I've also attached it so tabs are being maintained. You have to rename it to .txt as that's not an allowed type. I've renamed the txt to zip, but it's just txt.
The only thing I still have to check is the ii_style variable. To test it, I changed it to 1 in debug mode, but after another call to the messagebox it's still 1. So I might still get back on this. Also there's no more user interaction, whichever was allowed on the response window, other than choosing a button. Maybe, if you need that functionality, instead of overriding ii_style = 1, you would have to add a new ii_style = 2 for your "problem cases".
// u5, mjl, 15/11/18: appeonWeb doesn't like dots in parms:
//li_ret = super::of_processmessage()
gbl_errmess = true
//////////////////////////////////////////////////////////////////////////////
//
// Function: of_ProcessMessage
//
// Access: protected
//
// Arguments: None.
//
// Returns: integer
// The button returned from the message window.
// -1 if an error was encountered.
//
// Description: This function is called to process the Message.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0 Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
/*
* Open Source PowerBuilder Foundation Class Libraries
*
* Copyright (c) 2004-2017, All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted in accordance with the MIT License
*
* https://opensource.org/licenses/MIT
*
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals and was originally based on software copyright (c)
* 1996-2004 Sybase, Inc. http://www.sybase.com. For more
* information on the Open Source PowerBuilder Foundation Class
* Libraries see https://github.com/OpenSourcePFCLibraries
*/
//
//////////////////////////////////////////////////////////////////////////////
Integer li_rc
Integer li_testrc
// Set other information.
inv_errorpass.idt_date = DateTime(today(), now())
// As appropriate, run the attended/unattended process.
If ib_unattended Then
// Set the Default button as the return button for unattended mode.
inv_errorpass.ii_buttonclicked = inv_errorpass.ii_default
li_rc = inv_errorpass.ii_default
Else
// powerserver / appeon web doesn't like "." in arguments to function calls:
string ls_title, ls_text
icon licon
button lbtnStyle
int li_default
ls_title = inv_errorpass.is_title
ls_text = inv_errorpass.is_text
licon = inv_errorpass.ie_icon
lbtnStyle = inv_errorpass.ie_buttonstyle
li_default = inv_errorpass.ii_default
// Attended Mode. Open response window.
Choose Case ii_style
Case 0
// inv_errorpass.ii_buttonclicked = of_MessageBox('pfc_errorsrv_msg', &
// inv_errorpass.is_title, &
// inv_errorpass.is_text, inv_errorpass.ie_icon, &
// inv_errorpass.ie_buttonstyle, inv_errorpass.ii_default)
inv_errorpass.ii_buttonclicked = of_MessageBox('pfc_errorsrv_msg', &
ls_title, &
ls_text, licon, &
lbtnStyle, li_default)
Case 1
// Set the timeout option.
inv_errorpass.ii_timeout = ii_timeout
If ib_beep Then
beep(1)
End If
// v1, mjl, 08/11/19: use a real messagebox, not a response window, as a response window changes the way the messages on the stack are being executed:
//li_testrc = OpenWithParm(w_message, inv_errorpass)
n_msgbox ln_msgbox
li_testrc = ln_msgbox.of_messageboxtimeout( ls_title, ls_text, licon, lbtnStyle, li_default, ii_timeout)
inv_errorpass.ii_buttonclicked = li_testrc
// v1, mjl, 08/11/19: commented:
// If li_testrc > 0 Then
// // Get the structure passed by the response window for
// // any user input and buttonclicked.
// If IsValid(Message.powerobjectparm) Then
// inv_errorpass = Message.powerobjectparm
// End If
// End If
End Choose
End If
// If appropriate, log the error.
If (inv_errorpass.ii_severity >= ii_logseverity) Then
li_testrc = of_ProcessLog ()
End If
// If appropriate, send a notification.
If (inv_errorpass.ii_severity >= ii_notifyseverity) Then
li_testrc = of_ProcessNotify()
End If
//////////////////////////////////////////////////////////////////////////////////////////////
gbl_errmess = false
return inv_errorpass.ii_buttonclicked
So yes, I totally agree, the answer here is "You cannot".
Thank you for your explanations.
My problem is: I use PFC and there is a response window for displaying messages instead of using MessageBox.
The call stack in my application is much more complicated as in my example.
In my real case the triggered event causes in one of the subroutines in the deep of the code an error because of an external call and shows the response window to display the message. This causes a posted event to start at an unexpected moment. So the complete call stack gets disordered what causes unexpected behavior.
I have mostly worked in non-PFC apps since 2012 so I hope someone else reading this thread had your issue and found a workaround. Anyone?