Note: This page includes content based on the F1 documentation for Centura development. It may be partially converted to support APF development, but should be regarded to be of uncertain actuality. It is provided as is. Eventually, it should be replaced by documentation available from within Visual Studio.
Const.PM_UserMethod
Applications send the Const.PM_UserMethod message to an object to invoke application-defined user methods.
Name | Description |
---|---|
nWhat = wParam | Standard method parameter. Possible values are Const.METHOD_Inquire, Const.METHOD_Execute |
sMethod = SalString.FromHandle(Sys.lParam) | Name of method to execute. This is the name specified in the menu item, or Foundation1 properties. |
When nWhat = Const.METHOD_Inquire, the return value is TRUE if the method is available (possible to execute), FALSE otherwise.
When nWhat = Const.METHOD_Execute: the return value is TRUE if the method was successfully executed, FALSE otherwise.
Const.PM_UserMethod with the nWhat message is automatically sent every time a methods state is being investigated. Investigation of a method state can be triggered either by the framework, or by the application explicitly calling the MethodStateChanged method.
There is usually no need for an application to process the Const.PM_UserMethod message since it is automatically processed by the framework. To handle method the application should rather override the vrtUserMethod method.
This example defines a menu item invoking a user method.
Menu Item: Show &Details… Menu Settings Enabled When: SalSendMsg( i_hWndFrame, PM_UserMethod, METHOD_Inquire, SalHStringToNumber( 'show details' ) Checked When: Actions Call SalPostMsg( i_hWndFrame, PM_UserMethod, METHOD_Execute, SalHStringToNumber( 'show details' )/// Menu EnabledWhen Expression
private bool menuItem__Show_EnabledWhen() { return Sal.SendMsg(Sys.hWndForm, Const.PM_UserMethod, Const.METHOD_Inquire, ((SalString)"col show all").ToHandle()); } /// Menu Actions private SalNumber menuItem__Show_MenuActions() { Int.PostMessage(Sys.hWndForm, Const.PM_UserMethod, Const.METHOD_Execute, "col show all"); return 0; }