Inputdialog with two input fields?

IamBot

Member
Licensed User
Longtime User
Hi,

Is it possible to use Inputdialog function in order to get two input fields appear at the same time?

The purpose is to make the program ask for username and password and the input fields have to appear in the same window. There should of course also only be buttons, 'Login' and 'Cancel'.

Code currently looks like this:


PHP:
Sub Login_Click

   Dim Id As InputDialog
   'Id.PasswordMode = True
   Id.InputType = Id.INPUT_TYPE_DECIMAL_NUMBERS
   'Id.InputType = Id.INPUT_TYPE_NUMBERS
   'Id.InputType = Id.INPUT_TYPE_PHONE
   Id.Input = ""
   Id.Hint = "Username"
   Id.HintColor = Colors.ARGB(196, 255, 140, 0)
   
   ret = DialogResponse.CANCEL
   ret = Id.Show("Enter username and password:", "Login", "Login", "Cancel", "", Null)
   ToastMessageShow(ret & " : " & Id.Input, False)   
End Sub

It's pretty much a copy of the original, but I'm stuck :/

Thankful for some help or suggestion...
 

thedesolatesoul

Expert
Licensed User
Longtime User
And for some code:


B4X:
Sub ShowLoginPanel
   Dim p As Panel 
   Dim etun As EditText 
   Dim etpw As EditText 
   Dim lblun As Label 
   Dim lblpw As Label 
   
   p.Initialize("")
   etun.Initialize("etun")
   etpw.Initialize("etpw")
   lblun.Initialize("")
   lblpw.Initialize("")
   
   etun.SingleLine = True
   etpw.SingleLine = True
   etpw.PasswordMode=True
   
   Dim cd As CustomDialog 
   
   cd.AddView(p,2dip,0,90%x-4dip,220dip)
   p.AddView(etun,40dip,80dip,p.Width-80dip,48dip)
   p.AddView(etpw,40dip,150dip,p.Width-80dip,48dip)
   p.AddView(lblun,40dip,60dip,p.Width-80dip,40dip)
   p.AddView(lblpw,40dip,130dip,p.Width-80dip,40dip)

   p.Color=Colors.Black 
   etun.Hint="Username"
   etpw.Hint="Password"
   lblun.Text="Username"
   lblpw.Text="Password"
   cd.Show("XverhelstX Login","Login","Cancel","",Null)
   lblun.RequestFocus 
   
   If cd.Response = DialogResponse.CANCEL Then
      'Cancel stuff
      Return
   End If
   'Authenticate
   LuLu.Authenticate(etun.Text ,etpw.Text )
   
End Sub
 
Upvote 0

IamBot

Member
Licensed User
Longtime User
And for some code:


B4X:
Sub ShowLoginPanel
   Dim p As Panel 
   Dim etun As EditText 
   Dim etpw As EditText 
   Dim lblun As Label 
   Dim lblpw As Label 
   
   p.Initialize("")
   etun.Initialize("etun")
   etpw.Initialize("etpw")
   lblun.Initialize("")
   lblpw.Initialize("")
   
   etun.SingleLine = True
   etpw.SingleLine = True
   etpw.PasswordMode=True
   
   Dim cd As CustomDialog 
   
   cd.AddView(p,2dip,0,90%x-4dip,220dip)
   p.AddView(etun,40dip,80dip,p.Width-80dip,48dip)
   p.AddView(etpw,40dip,150dip,p.Width-80dip,48dip)
   p.AddView(lblun,40dip,60dip,p.Width-80dip,40dip)
   p.AddView(lblpw,40dip,130dip,p.Width-80dip,40dip)

   p.Color=Colors.Black 
   etun.Hint="Username"
   etpw.Hint="Password"
   lblun.Text="Username"
   lblpw.Text="Password"
   cd.Show("XverhelstX Login","Login","Cancel","",Null)
   lblun.RequestFocus 
   
   If cd.Response = DialogResponse.CANCEL Then
      'Cancel stuff
      Return
   End If
   'Authenticate
   LuLu.Authenticate(etun.Text ,etpw.Text )
   
End Sub

Wow! Thanks a lot :)

Works perfectly!
 
Upvote 0

PFlores81

Active Member
Licensed User
Longtime User
It can refer to anything. In my case, a sub in a code module that authenticates via HttpUtils.
In reality LuLu = Nonsense.


Ahh ok, makes sense then lol. I myself am trying to get a user made android app working for a known gaming site as they obviously do not appear to take the android community seriously. I was looking for some help from others to make it a collaboration. That and I really have never dealt with HttpUtils much at all. Some people say to pull some of the code from the site and have it layout or display in certain areas on the app. I just want it to be a basic app, login, you can see your name, which friends are online, your games, and the news feed. it would be limited as you cannot message anyone or really comment on their page.
 
Upvote 0

PFlores81

Active Member
Licensed User
Longtime User
If the website had an API it would have been easier. Or even if they have a mobile site. Otherwise it will be a hack job and if they change their website then your app wont work again.

Unfortunately they have not gotten back to me as far as an API, and to my knowledge there is no mobile site. If there were it could just be a webapp. I am trying to read as much as I can about it but with my limited time lately it's been interesting.
 
Upvote 0
Top