Display Dialog from condition statement

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
adale
Posts: 9
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Display Dialog from condition statement

Post by adale » Tue May 18, 2021 8:28 pm

I am having a bit of trouble with getting a dialog to display for me, and hoping someone can help point me in the right direction.
In my VL Web application, I have a View that has a RP panel which displays the user most recent log in information, and some other user profile data. No problems so far. In the Server module for this, I am checking various data fields to verify they are populated, or if there are flags that need to be addressed. If one of the parm fields is empty, I would like to have a Dialog open up so the user can update the data.
How can I get the dialog to open based upon the If_Cond statement?
I can get a dialog to open from a user based activity (click event), I just cant seem to get it to open based upon a cond statement in the coding.
The second question in this, is there a way to keep the dialog "in focus" so that only if one of the buttons in the Dialog is clicked will it close? Right now, if the user just clicks on anything outside of the Dialog, it simply closes.

User avatar
Dino
Posts: 124
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Re: Display Dialog from condition statement

Post by Dino » Thu May 20, 2021 8:18 am

the server module can return values (field_map *output, etc.), you can use those to send a value to the reusable part/view/web page, so they will know to open the dialog to ask for values. Once the dialog is complete, you should be able to call the server module again for reevaluation, or to save that specific value, etc.

the server module is running in the server, not in the client, so I cannot initiate an action in the client. It can respond with some information, so the client can take an action based on that.

on the other hand, I cannot reproduce the ability to close the dialog without clicking in the buttons in the dialog...

Image
if my webpage is like this:

Code: Select all

Begin_Com Role(*EXTENDS #PRIM_WEB) Theme(#SYS_THEME<MaterialDesignBlue>)

Define_Com Class(#test0519d) Name(#test0519d)
Define_Com Class(#PRIM_MD.Edit) Name(#Edit) Caption('Caption') Displayposition(1) Left(28) Parent(#COM_OWNER) Tabposition(1) Top(34)
Define_Com Class(#PRIM_MD.Edit) Name(#Edit1) Appearance(TextFieldBox) Caption('Caption') Displayposition(2) Left(30) Parent(#COM_OWNER) Tabposition(2) Top(127)
Define_Com Class(#PRIM_MD.Edit) Name(#Edit2) Appearance(TextFieldArea) Caption('Caption') Displayposition(3) Height(100) Left(35) Multiline(True) Parent(#COM_OWNER) Tabposition(3) Top(224)
Define_Com Class(#PRIM_MD.RaisedButton) Name(#Button) Caption('Validate and Save') Displayposition(4) Left(40) Parent(#COM_OWNER) Tabposition(4) Themedrawstyle('MediumTitle+Rounded') Top(328) Width(209)

Evtroutine Handling(#Test0519d.OkClicked) Std_Strng(#STD_STRNG)
#Edit.value := #STD_STRNG
Endroutine

Evtroutine Handling(#Button.Click)
Define_Com Class(#test0519sm.ValidateFields) Name(#ValidateFields)
#ValidateFields.Execute Std_Strng(#Edit.value) Retcode(#RETCODE)
If (#RETCODE = ER)
#Test0519d.show
Endif
Endroutine
End_Com
and my dialog test0519d is like this:

Code: Select all

Begin_Com Role(*EXTENDS #PRIM_DLG) Height(290) Width(320)

* Controls
Define_Com Class(#PRIM_MD.Label) Name(#TitleLabel) Caption('Fill the missing field') Displayposition(3) Left(0) Parent(#COM_OWNER) Tabposition(3) Top(0) Height(64) Width(318) Captionalignment(TopLeft) Ellipses(False) Wordwrap(True) Themedrawstyle('BottomDivider+Heading1') Paddingleft(24) Paddingright(24) Paddingtop(24)
Define_Com Class(#PRIM_MD.FlatButton) Name(#ButtonOk) Caption('OK') Displayposition(1) Left(230) Parent(#COM_OWNER) Tabposition(2) Tabstop(False) Themedrawstyle('ForegroundMediumPrimary') Top(244) Width(72)
Define_Com Class(#PRIM_MD.FlatButton) Name(#ButtonCancel) Caption('CANCEL') Displayposition(2) Left(149) Parent(#COM_OWNER) Tabposition(1) Tabstop(False) Top(244) Paddingleft(8) Paddingright(8) Width(73)
Define_Com Class(#PRIM_MD.Edit) Name(#Edit) Caption('Caption') Displayposition(4) Left(64) Parent(#COM_OWNER) Tabposition(4) Top(104)

* Events
Define_Evt Name(CancelClicked)
Define_Evt Name(OkClicked)
Define_Map For(*INPUT) Class(#STD_STRNG)

Evtroutine Handling(#ButtonOk.Click)
If (#Edit.value <> '')
Signal Event(OkClicked) Std_Strng(#EDIT.Value)
#COM_OWNER.Close
Endif
Endroutine

Evtroutine Handling(#ButtonCancel.Click)
Signal Event(CancelClicked)
#COM_OWNER.Close
Endroutine
End_Com
and my server module test0519sm is:

Code: Select all

Begin_Com Role(*EXTENDS #PRIM_SRVM)
Srvroutine Name(ValidateFields)
Field_Map For(*INPUT) Field(#std_strng)
Field_Map For(*OUTPUT) Field(#retcode)

If (#STD_STRNG = *BLANKS)
#retcode := ER
Endif
Endroutine
End_Com
I cant make the dialog close without filling the input field in it and clicking on ok (sending the correct value back) or cancel...

adale
Posts: 9
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Re: Display Dialog from condition statement

Post by adale » Thu May 20, 2021 9:20 pm

Dino,
Thanks for the input. The other piece I had to figure out was that initially my dialog was being called ( or initiated as I watching debug step through the lines of code), but the View as getting loaded on top of it, so the "client" was not seeing the dialog. I changed the server call from execute to executeAsync then put the call to the dialog inside of a .Completed evtroutine statement. This has a delay effect, but give the View time to load, then present the Dialog.
Being new the VL Web and RDMLX, I am still learning the flow or processing sequences.
Thanks again for your help.

Post Reply