1) Create the following user event in your application’s frame window
//////////////////////////////////////////////////////////////////////////////
// Event: ue_opensheet
//
// Description: Checks if the requested sheet is open. If it is, the sheet
// is brought to the top. If it isn't, a new sheet is opened.
//
// Arguments: None.
// Returns: None.
//
//////////////////////////////////////////////////////////////////////////////
// Revision History
//
// Date By Description/Comments
// -------- --- ----------------------------------------------
// 09/21/99 Initial Version
// 10/02/01 fjs Spun off much logic to wf_IsSheetOpen()
//
//////////////////////////////////////////////////////////////////////////////
string ls_requested_sheet_name
w_sheet lw_newsheet
// New sheet name
ls_requested_sheet_name = Upper(Message.StringParm)
if NOT wf_IsSheetOpen(ls_requested_sheet_name) then
// Search didn't find an open occurrence. Open a new sheet.
OpenSheet(lw_newsheet, ls_requested_sheet_name, this, 0, Layered!)
end if
1) Create the following user event in your application’s frame window
//////////////////////////////////////////////////////////////////////////////
// Event: ue_opensheetwithparm
//
// Description: Checks if the requested sheet is open. If it is, the sheet
// is brought to the top. If it isn't, a new sheet is opened.
//
// Arguments: None.
// Returns: None.
//
//////////////////////////////////////////////////////////////////////////////
// Revision History
//
// Date By Description/Comments
// -------- --- ----------------------------------------------
// 10/02/01 fjs Initial Version.
//
//////////////////////////////////////////////////////////////////////////////
double ld_parm
powerobject lpo_parm
str_opensheetwithparm lstr_parms
string ls_requested_sheet_name, ls_parm_type, ls_parm
w_sheet lw_newsheet
lstr_parms = Message.PowerObjectParm
if NOT wf_IsSheetOpen(ls_requested_sheet_name) then
// Search didn't find an open occurrence. Open a new sheet.
ls_requested_sheet_name = Upper(lstr_parms.s_sheet_name)
ls_parm_type = Lower(lstr_parms.s_parm_type)
choose case ls_parm_type
case "stringparm"
ls_parm = lstr_parms.a_parm_value
OpenSheetWithParm(lw_newsheet, ls_parm, ls_requested_sheet_name, this, 0, Layered!)
case "powerobjectparm"
lpo_parm = lstr_parms.a_parm_value
OpenSheetWithParm(lw_newsheet, lpo_parm, ls_requested_sheet_name, this, 0, Layered!)
case "doubleparm"
ld_parm = lstr_parms.a_parm_value
OpenSheetWithParm(lw_newsheet, ld_parm, ls_requested_sheet_name, this, 0, Layered!)
case else
if IsNull(ls_parm_type) then
ls_parm_type = "null"
end if
MessageBox("Error - w_lm_frame:ue_OpenSheetWithParm", 'Unknown parm type: "' + ls_parm_type + '"' )
Return
end choose
end if
2) Calling script in menu
The following will open the window "w_finishingtimesheet" and pass it the parameter "Menu"
// Set the structure variables
istr_opensheetwithparm.s_parm_type = 'stringparm'
istr_opensheetwithparm.s_sheet_name = 'w_finishingtimesheets'
istr_opensheetwithparm.a_parm_value = 'Menu'
Message.PowerObjectParm = istr_opensheetwithparm
of_SendMessage("ue_opensheetwithparm" )
Over the years of being a PowerBuilder developer, I have recorded many things I have learned and I may need to refer to in the future. Some of these discoveries date back to PowerBuilder 4 and may not be relavent with the later versions of PB
I am still in the process of transferring all my notes. (Hey, I have other things to do)