|
of_restoremenu
|
|
Full name
|
pfc_n_cst_winsrv_preference.of_restoremenu
|
Access
|
protected
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
protected function integer of_restoremenu(boolean,string,string,menu)
|
Name
|
Datatype
|
lb_visible
|
boolean
|
li_cnt
|
integer
|
li_limit
|
integer
|
li_rc
|
integer
|
lnv_conversion
|
n_cst_conversion
|
ls_item
|
string
|
ls_retvalue
|
string
|
protected function integer of_restoremenu (boolean ab_useregistry, string as_keyorini, string as_inisection, menu am_source);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_RestoreMenu
//
// Access: protected
//
// Arguments:
// ab_UseRegistry Function behavior. - use the registry or an .ini file.
// as_KeyOrIni The KeyName for use with the Registry or the IniFile name
// for use with an .Ini file.
// as_IniSection The name of the .Ini section.
// am_source The menu that should be restored.
//
// Returns: Integer
// 1 if it succeeds and -1 if an error occurs.
//
// Description: Recursively restore all Menu items from either the registry
// or an .Ini file.
// If a desired value is not found, then current value found
// on the menu is left as it is.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0 Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
// 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
integer li_limit
integer li_cnt
string ls_item
string ls_retvalue
boolean lb_visible
n_cst_conversion lnv_conversion
//Check arguments
If Not IsValid(am_source) or IsNull(am_source) Then
Return -1
End If
//Current entry
ls_item = 'menuitem.'+am_source.ClassName()
//Check if the menu item was stored
li_rc = of_Restore (ab_UseRegistry, as_KeyOrIni, as_IniSection, &
ls_item+'.toolbaritembarindex', ls_retvalue,'')
If Len(ls_retvalue) > 0 Then
If IsNumber(ls_retvalue) Then
am_source.ToolbarItemBarIndex = Integer(ls_retvalue)
End If
If ib_toolbaritemorder Then
li_rc = of_Restore (ab_UseRegistry, as_KeyOrIni, as_IniSection, &
ls_item+'.toolbaritemorder', ls_retvalue, '')
If IsNumber(ls_retvalue) Then
am_source.ToolbarItemOrder = Integer(ls_retvalue)
End If
End If
If ib_toolbaritemspace Then
li_rc = of_Restore (ab_UseRegistry, as_KeyOrIni, as_IniSection, &
ls_item+'.toolbaritemspace', ls_retvalue, '')
If IsNumber(ls_retvalue) Then
am_source.ToolbarItemSpace = Integer(ls_retvalue)
End If
End If
If ib_toolbaritemvisible Then
li_rc = of_Restore (ab_UseRegistry, as_KeyOrIni, as_IniSection, &
ls_item+'.toolbaritemvisible', ls_retvalue,'')
lb_visible = lnv_conversion.of_boolean(ls_retvalue)
If Not IsNull(lb_visible) Then
am_source.ToolbarItemVisible = lb_visible
End If
End If
End if
//Search through the rest of the menu
li_limit = UpperBound (am_source.item)
For li_cnt = 1 to li_limit
of_RestoreMenu (ab_UseRegistry, as_KeyOrIni, as_IniSection, am_Source.item[li_cnt])
Next
Return 1
end function