WD Managing the main menu of a window by programmin - WD Gerenciando o menu principal de uma janela por programação
IF bModif = True THEN
// "MenuSelectMinus is used to gray an option."
MenuSelectMinus(MenuIdentifier())
//You have the ability to use the properties
// With indirection in this case because the name of the option is a string returned by MenuName()
//MenuName(),indControl}..State=Grayed
swl="MenuSelectMinus is used to gray an option."+CR+" MenuSelectMinus("+MenuIdentifier()+")"+CR+...
"You can also use the properties of the menus: "+CR+...
TAB+MenuName()+"..State=Grayed"
SOURCE_=swl
OptionImage()
ELSE
Info("This menu option must not be modified") //This menu option must not be modified
END
//-------------------------------------------------------------------------------------------
IF bModif = True THEN
// "MenuSelectPlus is used to make a grayed option or an invisible option selectable."
MenuSelectPlus(MenuIdentifier())
////You have the ability to use the properties
// With indirection in this case because the name of the option is a string returned by MenuName()
//{MenuName(),indControl}..Visible=True
//{MenuName(),indControl}..State=Active
swl="MenuSelectPlus allows a grayed option or an invisible option to be made selectable."+CR+" MenuSelectPlus("+MenuIdentifier()+")"+CR+...
"You can also use the properties of the menus: "+CR+...
TAB+MenuName()+"..Visible=True"+CR+...
TAB+MenuName()+"..State=Active"
SOURCE_=swl
//update the treeview
OptionImage()
ELSE
Info("This menu option must not be modified") //This menu option must not be modified
END
//-----------------------------------------------------------------------------------
IF bModif = True
// "MenuInvisible is used to make an option invisible."
MenuInvisible(MenuIdentifier())
//You have the ability to use the properties
// With indirection in this case because the name of the option is a string returned by MenuName()
//{MenuName(),indControl}..Visible=False
swl="InvisibleMenu allows an option to be made invisible."
swl=swl+CR+" MenuInvisible("+MenuIdentifier()+")"+CR+...
"You can also use the properties of the menus: "+CR+...
TAB+MenuName()+"..Visible=False"
SOURCE_=swl
//update the treeview
OptionImage()
ELSE
Info("This menu option must not be modified") //This menu option must not be modified
END
//--------------------------------------------------------------------------
IF bModif=True THEN
MenuSelectPlus(MenuIdentifier())
// "MenuSelectPlus is used to make an invisible option visible."
//You have the ability to use the properties
// With indirection in this case because the name of the option is a string returned by MenuName()
//{MenuName(),indControl}..Visible=True
swl="MenuSelectPlus allows an invisible option to be made visible."+CR+" MenuSelectPlus("+MenuIdentifier()+")"+CR+...
"You can also use the properties of the menus: "+CR+...
TAB+MenuName()+"..Visible=True"
SOURCE_=swl
//update the treeview
OptionImage()
ELSE
Info("This menu option must not be modified") //This menu option must not be modified
END
//---------------------------------------------------------------------
IF bModif=True THEN
MenuMark(MenuIdentifier())
// "MenuMark is used to mark an option."
// "The non-final options cannot be marked."
// "For example:"
swl="MenuMark is used to mark an option."+CR+" MenuMark("+MenuIdentifier()+")"
SOURCE_=swl
//update the treeview
OptionImage()
ELSE
Info("This menu option must not be modified") //This menu option must not be modified
END
//----------------------------------------------------------
IF bModif=True THEN
MenuUnMark(MenuIdentifier())
//"MenuUnmark is used to remove the mark from an option."
//"For example:"
swl="MenuUnmark is used to remove the checkmark from an option."
swl=swl+CR+" MenuUnMark("+MenuIdentifier()+")"
SOURCE_=swl
//update the treeview
OptionImage()
ELSE
Info("This menu option must not be modified") //This menu option must not be modified
END
//------------------------------------------------------------
//was en element other than the root selected?
IF Position(TreeSelect(TREEMENUS),TAB)<1 THEN
Info("Select a menu element in the treeview.")
ReturnToCapture()
END
// Checks whether it is not a separation line
IF Replace(Replace(ExtractString(TreeSelect(TREEMENUS),1,TAB,FromEnd),"-",""),"&","")="" THEN
Info("Operation not allowed on a separator.")
ReturnToCapture()
END
ExecuteProcess(MenuName(),trtMenuOption)
swl="ExecutePriocess is used to run an existing process."+CR+" ExecuteProcess("+MenuName()+",trtMenuOption)"
SOURCE_=swl
//--------------------------------------------------------------------
IF bModif=True
IF CAPOPTION1="" THEN
Info("Enter the new caption in the control.")
ReturnToCapture(CAPOPTION1)
ELSE
// Checks whether it is not a separation line
IF Replace(Replace(ExtractString(TreeSelect(TREEMENUS),1,TAB,FromEnd),"-",""),"&","")="" THEN
Info("The modification of an option caption cannot be used on a separation line.")
RETURN
END
// "MenuLable is used to modify the caption of an option."
MenuLabel(MenuIdentifier(),CAPOPTION1)
//You have the ability to use the properties
// With indirection in this case because the name of the option is a string returned by MenuName()
//{MenuName(),indControl}..Caption=CapOption
swl="MenuLable is used to modify the caption of an option."+CR+" MenuLabel("+MenuIdentifier()+","""+CAPOPTION1+""")"+CR+...
"You can also use the properties of the menus: "+CR+...
TAB+MenuName()+"....Caption="""+CAPOPTION1+""""
SOURCE_=swl
// Writes the new caption into the list
TreeModify(TREEMENUS,TreeSelect(TREEMENUS),CAPOPTION1)
END
ELSE
Info("This menu option must not be modified") //This menu option must not be modified
END