Fired when the mouse is clicked on the control
Member of Toolbar Button (PRIM_SPBN)
|Origin||*Input||PRIM_CTRL||Reference to the control on which the event was initially fired|
|Handled||*Both||Boolean||Set to true to stop the event being propagated to the parent control|
The Click event is fired when the user presses and releases the left mouse button while the mouse is within the bounds of the same control. The Click event is a routed event. This means that it can be detected on the control that was under the mouse pointer at the time of the click, as well as other controls in the parent chain. The Origin and Handled parameters of the event provide the source of the event and a means to prevent propagation up the parent chain respectively
The example has 2 clickable buttons. The Click event is flagged as handled True if Button2 is clicked. If it's not, the click event for the page will fire.
Begin_Com Role(*EXTENDS #PRIM_WEB) Height(440) Width(688) Define_Com Class(#PRIM_PHBN) Name(#Button1) Displayposition(1) Left(128) Parent(#COM_OWNER) Tabposition(1) Top(80) Width(145) Caption('Routed click') Define_Com Class(#PRIM_PHBN) Name(#Button2) Caption('Handled click') Displayposition(2) Left(128) Parent(#COM_OWNER) Tabposition(2) Top(117) Width(145) Define_Com Class(#PRIM_LABL) Name(#ButtonClick) Caption('Button clicked') Displayposition(3) Ellipses(Word) Height(25) Left(334) Parent(#COM_OWNER) Tabposition(3) Tabstop(False) Top(85) Verticalalignment(Center) Width(203) Alignment(Center) Visible(False) Define_Com Class(#PRIM_LABL) Name(#PageClick) Displayposition(4) Ellipses(Word) Height(25) Left(334) Parent(#COM_OWNER) Tabposition(4) Tabstop(False) Top(115) Verticalalignment(Center) Width(203) Caption('Page clicked') Alignment(Center) Visible(False) Evtroutine Handling(#Button1.Click #Button2.Click) Com_Sender(#Sender) Handled(#Handled) #PageClick.Visible := False #ButtonClick.Caption := #Sender.Caption #ButtonClick.Visible := True #Handled := (#Sender *IsEqualTo #Button2) Endroutine Evtroutine Handling(#Com_Owner.Click) Origin(#Origin) #PageClick.Visible := True #PageClick := #Origin.Name #ButtonClick.Visible := False Endroutine End_Com
LANSA Version 15, April 2020