InputDialog bug

cbanks

Active Member
Licensed User
Longtime User
Has anyone else noticed a bug when using InputDialogs or CustomDialogs? Sometimes when I tell it show the dialog it returns a -3 error response before I even tap on one of the buttons in the dialog window. Is there a way to fix this?
 

specci48

Well-Known Member
Licensed User
Longtime User
Can you post you code that shows up the dialog?
The value -3 is the return value of DialogResponse.CANCEL. Maybe you have pressed the back-button accidentally.


specci48
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
I too get this problem. with mine it is -1

Dim ret As Int

dlgCode.Input=dlgCode.INPUT_TYPE_TEXT
ret = DialogResponse.CANCEL
ret=dlgCode.Show("Enter The New Customer Code.", "Assign Customer Code", "Ok", "Cancel","",Null)
NewCode = dlgCode.Input.ToUpperCase

What causes it?
 
Upvote 0

pluton

Active Member
Licensed User
Longtime User
I too get this problem. with mine it is -1

Dim ret As Int

dlgCode.Input=dlgCode.INPUT_TYPE_TEXT
ret = DialogResponse.CANCEL
ret=dlgCode.Show("Enter The New Customer Code.", "Assign Customer Code", "Ok", "Cancel","",Null)
NewCode = dlgCode.Input.ToUpperCase

What causes it?

Hi Smee
I belive that your code must go like this
B4X:
Dim ret As Int
      
dlgCode.Input=dlgCode.INPUT_TYPE_TEXT
'********************************
' ret = DialogResponse.CANCEL - this line put your response (ret) automaticly to Cancel (-1) even before started Dialog
'********************************
ret=dlgCode.Show("Enter The New Customer Code.", "Assign Customer Code", "Ok", "Cancel","",Null)
NewCode = dlgCode.Input.ToUpperCase
' Here you must do like this
If ret = DialogResponse.POSITIVE Then
' do something if positive
Else
'do something if it is no or cancel
End If
 
Last edited:
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
Thanks for the reply,

I had already tried that before trying the initialising line
ret = DialogResponse.CANCEL

I saw that in another post so tried it. didnt work either. I still got the -1

:confused:
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
Yes.
I have stepped through the code and as soon as the dialog is called it appears with a -1 already in it

this is the larger snippet of code
B4X:
   txt = "DO YOU WANT TO DELETE THIS CODE OR ASSIGN IT"
   Answ=Msgbox2(txt,"ATTENTION","DELETE","CANCEL","ASSIGN",LoadBitmap(Main.filesFolder,"question.gif"))
   If Answ=DialogResponse.POSITIVE Then
      'DELETE
   Else If Answ=DialogResponse.NEGATIVE Then
      'ASSIGN
      Dim dlgCode As InputDialog
      Dim NewCode As String
      Dim ph As Phone
      Dim ret As Int
      
      dlgCode.Input=dlgCode.INPUT_TYPE_TEXT
      ret = DialogResponse.CANCEL
      ret=dlgCode.Show("Enter The New Customer Code.", "Assign Customer Code", "Ok", "Cancel","",Null)
      NewCode = dlgCode.Input.ToUpperCase
 
Last edited:
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
Yes, then when i click the Assign option the input dialog shows along with the keyboard but the input box already has a -1 inside it as though it was being set as the default value similar to the vb command

inputbox("Test","Title",default value)
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
i have tried this
dlgCode.INPUT_TYPE_TEXT

dlgCode.INPUT_TYPE_TEXT=1

dlgCode.INPUT_TYPE_TEXT=dlgCode.INPUT_TYPE_TEXT

but i cannot get the syntax correct
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
:sign0137:

I didnt even notice that inputtype at the bottom

Thank you Erel
 
Upvote 0
Top