In the Visual LANSA editor, delete the button on the slider, switch to the Source tab and paste in this code:
Define_Com Class(#PRIM_MD.Edit) Name(#TestMessage) Appearance(TextFieldBox) Caption('Caption') DisplayPosition(1) Left(0) Parent(#CustomPanelBody) TabPosition(1) Top(0) Width(865) Placeholder('Type your message here') Height(57)
Define_Com Class(#PRIM_MD.RaisedButton) Name(#Button) Caption('Issue Message via Command Handler') DisplayPosition(2) Left(0) Parent(#CustomPanelBody) TabPosition(2) ThemeDrawStyle('MediumAccent') Top(58) Width(865)
Display the Design tab. You now have an edit box on the panel in which you can enter a message. The button next to it will signal the message from the slider to the Framework.
(You can use the Layout tab to position the label and the button.)
Create a Click event routine for the button, and add this SignalEvent statement to it:
#Com_Owner.avSignalEvent Withid(ShowMessage) Notifyself(False) Sendainfo1(#TestMessage) To(FRAMEWORK)
Compile the slider.
Next you need to make a component listen to the ShowMessage event being signalled. To do this, open a command handler (if you are using the SCRUD example, the Details command handler XXX_XHOMESALE_SCRUD_Handler).
Paste this event routine into the command handler:
Evtroutine Handling(#Com_owner.avEvent) Withid(#EventId) Withainfo1(#AInfo1)
If (#EventId = ShowMessage)
#AVFRAMEWORKMANAGER.avIssueMessage Text(#AInfo1) Requester(#COM_OWNER) Clearexistingmessages(True)
Endif
Endroutine
The routine listens for the ShowMessage event, and when it receives it, it issues the message.
Compile the command handler.
Switch to the workbench and execute the Framework to test the signalling.
First display a command handler for a business object instance in your business object. Then display the bottom slider, enter a message in the edit box and click the Issue Message via Command Handler button.
The message is displayed in the command handler's status bar.
You might want to turn on tracing when you execute the Framework to see the event being signalled and received. To do this select the option Turn Tracing On in the Execute Framework as VLF-ONE Application dialog:
You might want to clear the trace before you test signalling by clicking Clear Trace: