Cancel
Showing results for 
Search instead for 
Did you mean: 

API error with User Dialog

Valued Contributor
Valued Contributor

Hello,

 

I made an API which uses a User Dialog. I added a Cancel button to my dialog box and if I run the API and click this Cancel button, I have the following error:

 

API Error (Line 10): (10031) User pressed cancel.
 -->    Dialog dlg

 

Here is a part of a my API:

 

 

Sub Main
    Dim App As femap.model
    Set App = feFemap()

    Begin Dialog UserDialog 400,203 ' %GRID:10,7,1,1
        CancelButton 200,140,140,35
        OKButton 50,140,130,35
    End Dialog
    Dim dlg As UserDialog
    Dialog dlg
    
End Sub

 

Could anyone help me on how to use the cancel button ?

 

Thanks !

3 REPLIES

Re: API error with User Dialog

Siemens Phenom Siemens Phenom
Siemens Phenom

The Dialog function returns a value, since your code is not processing this, it's letting you know via the Error.  If you collect the return code, it seems to work fine -

 

Sub Main
    Dim App As femap.model
    Set App = feFemap()

    Begin Dialog UserDialog 400,203 ' %GRID:10,7,1,1
        CancelButton 200,140,140,35
        OKButton 50,140,130,35
    End Dialog
    Dim dlg As UserDialog
    rc = Dialog( dlg )

    Select Case rc
    Case - 1
        Msg = "User Pressed OK"
        App.feAppMessage( FCM_NORMAL, Msg )
    Case 0
        Msg = "User Pressed Cancel"
        App.feAppMessage( FCM_NORMAL, Msg )
    Case Else
        Msg = "User Somehow Did Something Else"
        App.feAppMessage( FCM_NORMAL, Msg )
    End Select


End Sub

Re: API error with User Dialog

Valued Contributor
Valued Contributor
Thanks for the help Mark !

Re: API error with User Dialog

Experimenter
Experimenter

Hello. Please tell me what is this operator 

 %GRID:10,7,1,1

Can't find anywhere description