How do I detect wich button the user pressed in the iLogic-form?
I can show it like this:
result=iLogicForm.ShowGlobal("MyForm", FormMode.Modal)
I guess that result is of type FormReturnValue - but I can't guess the qualifier (FormReturnValue.OK / FormReturnValue.OkBtn / ?)
Solved! Go to Solution.
Solved by psp. Go to Solution.
Solved by Vladimir.Ananyev. Go to Solution.
Isn't there any way to detect what button is pressed?
I have a lot of stuff in my rule, so it will run for some time after the user closes the form. That is why I want to give the user a chance to cancel the dialog.
The documentation says "similar to System.Windows.Forms.DialogResult - but typecasting isn't possible.
Autodesk.iLogic.Interfaces.xml:
<member name="T:Autodesk.iLogic.Interfaces.FormResult">
<summary>
A return value of a form: usually indicates which button caused the form to be closed.
</summary>
<remarks>
This is similar to System.Windows.Forms.DialogResult.
See FormReturnValue for the full return value.
</remarks>
</member><member name="T:Autodesk.iLogic.Interfaces.FormReturnValue">
<summary>
The full form return value, including the FormResult. If Result is RuleButtonClose or RuleButtonApplyAndClose, RuleName
will contain the name of the rule that is associated with the rule button that caused the form to close.
</summary>
Any help is welcome!
Poul
Try this variant:
Dim Question As String = "Do you like iLogic?" Dim Title As String = "iLogic Forms" Dim R As System.Windows.Forms.DialogResult R = MessageBox.Show(Question, Title, _ MessageBoxButtons.YesNoCancel, _ MessageBoxIcon.Question, _ MessageBoxDefaultButton.Button1) Dim St As String Select Case R Case vbYes St = "Yes" Case vbNo st = "No" Case vbCancel st = "Cancel" Case Else st = "Something unexpected. Error?" End Select 'results visualization MessageBox.Show( st, title, _ MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
iLogic rules editor has the wizard for MessageBox expressions.
Thank you for your input. But this is just handling result from an ordinary .Net messagebox.
My problem is to detect what is pressed in an iLogic-form, not a messagebox.
I have forms where i can change my fx-parameters etc.
PSP
Create modal form with name "Form 1" and run this rule:
'run for modal form "Form 1" Dim R As FormReturnValue = iLogicForm.Show("Form 1") Dim St As String Select Case R.Result.tostring Case "Cancel" st = "Cancel" Case "OK" st = "OK" Case "Close" st = "Close" Case Else st="??? " & R.Result.tostring End Select MsgBox(st )
Hello,
I was glad I finally found a solution for this problem. But unfortunately it doesn't work. I copied and pasted the code into a rule and made a nodal form called 'Form 1' as told in the description of Vladimir
But I always immidiately get the messagbox showing: ??? None. I don't get the chance to click any button at all.
I tried it with different buttons in the form but nothing works. I need to be able to cancel the rule from completion when clicking the cancelbutton in the form.
Who can help me?
Best regards,
Antwan
If you create 2 rules, one for Ok and one for Cancel and use these in your Form instead of the default Predifined Buttons you are totaly in control of the actions when the user pressed a button.
Rob.