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_phbn) Name(#IssueTestMessageButton) Parent(#CustomPanelBody) Caption('Issue Message via Command Handler') Displayposition(1) Tabposition(1) Width(239) Top(16) Left(424)
Define_Com Class(#Prim_edit) Name(#TestMessage) Parent(#CustomPanelBody) Displayposition(2) Tabposition(2) Width(407) Tabstop(False) Top(16) Placeholder('Type your message here')
Display the Design tab. You now have an edit box on the slider in which you can enter a message. The button next to it will signal the message from the slider to the Framework.
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)
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 may 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: