Form S_206F01 - Chat Form

LANSA

Form S_206F01 - Chat Form
* ===================================================================
*
* Component : S_206F01
* Type : Form
* Ancestor : PRIM_FORM
*
* Description : Chat Session Form
*
* Disclaimer : The following material is supplied as sample material
* only. No warranty concerning this material or its use
* in any way whatsoever is expressed or implied.
*
* ===================================================================
Function Options(*DIRECT)
Begin_Com Height(545) Layoutmanager(#SPLM_1) Left(262) Top(112) Visualstyle(#VS_NORM) Width(720)
* Split Layout Managers
Define_Com Class(#PRIM_SPLM) Name(#SPLM_1) Orientation(Vertical)
Define_Com Class(#PRIM_SPLM) Name(#SPLM_2)
Define_Com Class(#PRIM_SPLM) Name(#SPLM_3) Dividerstyle(Gap) Orientation(Vertical)

* Attachment Layout Managers
Define_Com Class(#PRIM_ATLM) Name(#ATLM_1)
Define_Com Class(#PRIM_ATLM) Name(#ATLM_2)
Define_Com Class(#PRIM_ATLI) Name(#ATLI_2) Attachment(Bottom) Manage(#PHBN_1) Parent(#ATLM_2)
Define_Com Class(#PRIM_ATLI) Name(#ATLI_3) Attachment(Center) Manage(#EDIT_1) Parent(#ATLM_2)

* Left hand panel
Define_Com Class(#PRIM_PANL) Name(#PANL_1) Displayposition(1) Height(518) Layoutmanager(#SPLM_3) Left(0) Parent(#COM_OWNER) Tabposition(1) Tabstop(False) Top(0) Width(509)
Define_Com Class(#PRIM_SPLI) Name(#SPLI_1) Manage(#PANL_1) Parent(#SPLM_1)
* List View to display the messages
Define_Com Class(#PRIM_LTVW) Name(#LTVW_1) Displayposition(1) Fullrowselect(True) Height(518) Left(0) Parent(#PANL_1) Tabposition(1) Top(0) Width(509)
Define_Com Class(#PRIM_LVCL) Name(#LVCL_1) Displayposition(1) Parent(#LTVW_1) Source(#S_206FRM) Width(21) Widthtype(Fixed)
Define_Com Class(#PRIM_LVCL) Name(#LVCL_2) Displayposition(3) Parent(#LTVW_1) Source(#S_206MESS) Width(269) Widthtype(Characters)
Define_Com Class(#PRIM_LVCL) Name(#LVCL_3) Caption('Type') Captiontype(Caption) Columnalign(Center) Displayposition(2) Parent(#LTVW_1) Source(#S_206TYPE) Width(8) Widthtype(Fixed)
Define_Com Class(#PRIM_SPLI) Name(#SPLI_5) Manage(#LTVW_1) Parent(#SPLM_3)
Define_Com Class(#PRIM_SPLI) Name(#SPLI_7) Manage(#LTVW_1) Parent(#SPLM_3)

* Right hand panel
Define_Com Class(#PRIM_PANL) Name(#PANL_2) Displayposition(2) Height(518) Layoutmanager(#SPLM_2) Left(513) Parent(#COM_OWNER) Tabposition(2) Tabstop(False) Top(0) Width(199)
Define_Com Class(#PRIM_SPLI) Name(#SPLI_2) Manage(#PANL_2) Parent(#SPLM_1) Weight(1)

* Top right hand panel
Define_Com Class(#PRIM_PANL) Name(#PANL_3) Displayposition(1) Height(465) Layoutmanager(#ATLM_1) Left(0) Parent(#PANL_2) Tabposition(1) Tabstop(False) Top(0) Width(199)
* List View to display the current users
Define_Com Class(#PRIM_LTVW) Name(#LTVW_2) Displayposition(1) Fullrowselect(True) Height(465) Left(0) Parent(#PANL_3) Tabposition(1) Top(0) Width(199)
Define_Com Class(#PRIM_LVCL) Name(#LVCL_4) Displayposition(1) Parent(#LTVW_2) Source(#S_206FRM) Width(41) Widthtype(Remainder)
Define_Com Class(#PRIM_ATLI) Name(#ATLI_1) Attachment(Center) Manage(#LTVW_2) Parent(#ATLM_1)
Define_Com Class(#PRIM_SPLI) Name(#SPLI_3) Manage(#PANL_3) Parent(#SPLM_2) Weight(1)

* Bottom right hand panel
Define_Com Class(#PRIM_PANL) Name(#PANL_4) Displayposition(2) Height(49) Layoutmanager(#ATLM_2) Left(0) Parent(#PANL_2) Tabposition(2) Tabstop(False) Top(469) Width(199)
Define_Com Class(#PRIM_PHBN) Name(#PHBN_1) Buttondefault(True) Caption('Send Message') Displayposition(1) Left(0) Parent(#PANL_4) Tabposition(1) Top(24) Width(199)
* Edit Box to send messages
Define_Com Class(#PRIM_EDIT) Name(#EDIT_1) Displayposition(2) Height(24) Left(0) Maxlength(213) Parent(#PANL_4) Tabposition(2) Top(0) Width(199)
* Push button to send messages
Define_Com Class(#PRIM_SPLI) Name(#SPLI_4) Manage(#PANL_4) Parent(#SPLM_2)

* The pop up window for when a person sends a message directly to another user
Define_Com Class(#S_206F03) Name(#MESSAGEWINDOW)
* The interface form which talks to the iSeries
Define_Com Class(#S_206F02) Name(#INTERFACE)

Evtroutine Handling(#INTERFACE.AddUser) Alias(#FRM206)
Change Field(#S_206FRM) To('#FRM206.value')
* Adds a user to the user list
Add_Entry To_List(#LTVW_2)
Endroutine

Evtroutine Handling(#INTERFACE.DeleteUser) Alias(#FRM206)
Change Field(#S_206ALS) To('#FRM206.value')
* Deletes a user from the user list
Selectlist Named(#LTVW_2)
If Cond('#S_206ALS *EQ #S_206FRM')
Dlt_Entry From_List(#LTVW_2)
Leave
Endif
Endselect
Endroutine

Evtroutine Handling(#INTERFACE.ReceiveMsg) Message(#MSG206) Request(#CMD206) Alias(#FRM206) Type(#TYP206)
Change Field(#S_206MESS) To(#MSG206)
Change Field(#S_206FRM) To(#FRM206)
Change Field(#S_206TYPE) To(#TYP206)
* Adds a message to the List View
Add_Entry To_List(#LTVW_1)
Use Builtin(OV_SOUND_ALARM) With_Args(N)
Endroutine

Evtroutine Handling(#PHBN_1.Click)
* Takes the value in the edit box and sends it as a message to the Interface form.
Change Field(#S_206MESS) To('#EDIT_1.VALUE')
Invoke Method(#INTERFACE.sendtoall) Message(#S_206MESS)
Set Com(#EDIT_1) Value()
Endroutine

Evtroutine Handling(#COM_OWNER.Initialize) Options(*NOCLEARMESSAGES *NOCLEARERRORS)
* Changes the Caption for the form to the User Name
Set Com(#COM_OWNER) Caption(*USER)
* Indicates to the Interface form that it is closing.
Invoke Method(#INTERFACE.starting)
Endroutine

Evtroutine Handling(#COM_OWNER.Closing) Options(*NOCLEARMESSAGES *NOCLEARERRORS)
* When the form is closed it sends a message to the Interface form to indicate that it is closing.
Invoke Method(#INTERFACE.ending)
Endroutine

Evtroutine Handling(#LTVW_2.DoubleClick) Options(*NOCLEARMESSAGES *NOCLEARERRORS)
* When a user double clicks on a name in the user list, the MessageWindow form pops up for the individual message to be typed into.
* The name of the selected user is passed to the message box.
Invoke Method(#MESSAGEWINDOW.WriteMessage) Alias(#S_206FRM)
Endroutine

Evtroutine Handling(#MESSAGEWINDOW.UserMessage) Message(#MSG206) Alias(#ALS206)
* When the message window closes it returns the message and the name of the person to whom the message will be sent to the
* main form, which then invokes the sendtoone method on the Interface reusable part.
Invoke Method(#INTERFACE.sendtoone) Message(#MSG206) Sendto(#ALS206)
Endroutine
End_Com