Making use of the PrompterActivate event to prepare a prompter form
|Date:||10 December 2008|
|Product/Release:||Visual LANSA (RDMLX)|
|Abstract:||PrompterActivate Event allows you to prepare a prompter form before displaying it|
|Submitted By:||LANSA Technical Support|
The PrompterActivate event is triggered when the user clicks on the prompter button. This event is intended to allow access to the prompter form before it displays, so that initialization processing can be performed. The event contains a reference to the prompter form about to be called, so it is possible to pass values to the prompter form by calling a method, or setting a property on it. However at design-time, the IDE does not know which form will be called, so the reference to the prompter form only returns a generic PRIM_FORM. This means that none of the custom methods or properties can be accessed.
In order to allow access to the properties or methods contained in the prompter form, the PRIM_FORM must be cast into an instance of the prompter form, as per the RDMLX source code below:
EVTROUTINE HANDLING(#CUSTOMER.PrompterActivate) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS) Form(#PromptForm) (#PromptForm *As #CustPrmpt).SetCaption("Hello World") ENDROUTINE
This assumes that #CustPrmpt is the name of the prompter form. Note that the form being called hasn’t actually been initialized when this event executes, so the initialization logic will be performed after the PrompterActivate event completes.