DateDialog and EditText

ciginfo

Well-Known Member
Licensed User
Longtime User
Bonjour,

When i click in an EditText i should want appear a DateDialog et no the keyboard.
How to do?

Merci
 

gapi

Active Member
Licensed User
Longtime User
double click instead

Why do I have double click on the text field to bring up the datedialog? On first click appear text editor ... on second click DateDialog ...

tnx
 
Upvote 0

gapi

Active Member
Licensed User
Longtime User
Why not use a label instead?

Sent from my GT-I9000 using Tapatalk 2

thanks @thedesolatesoul ;) now I've another issue ... two labels declared in global section, one work other not !

The one is in normal activity scope, the second is located within a Dialog, is this the problem?
the code:

B4X:
Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.
   Dim txtData, txt_DataConsegna As Label
End Sub

B4X:
Sub txtData_Click()
   Dim Dd As DateDialog
   Dim ret As Int
   ' set the date shown when the dialog is openend
   Dd.DateTicks = DataOdierna   
   ret = Dd.Show("Select a date", "Date", "OK", "", "Cancel", Null)
   If ret = DialogResponse.CANCEL Then Return
   txtData.Text = DateTime.Date(Dd.DateTicks)
   ' save the selected date, so it can be shown again
   DataOdierna = Dd.DateTicks
End Sub

'This label is declared in sub
Sub txt_DataConsegna_Click()
   Dim Dd As DateDialog
   Dim ret As Int
   ' set the date shown when the dialog is openend
   Dd.DateTicks = DataOdierna   
   ret = Dd.Show("Select a date", "Date", "OK", "", "Cancel", Null)
   If ret = DialogResponse.CANCEL Then Return
   txt_DataConsegna.Text = DateTime.Date(Dd.DateTicks)
   ' save the selected date, so it can be shown again
   DataOdierna = Dd.DateTicks
End Sub

and here where I make label on fly (initialize)

B4X:
Sub openDialog_Orders
 Dim cd As CustomDialog
 Dim scv As ScrollView
 Dim pnl As Panel
   scv.Initialize(390)
   pnl.Initialize("pnl")
   
 Dim bgnd As ColorDrawable
   bgnd.Initialize(Colors.Black, 5dip)
   pnl.Background = bgnd
   
'....
'......
txt_DataConsegna.Initialize("txt_DataConsegna")      
txt_DataConsegna.text = DateTime.Date(DataOdierna)
End Sub
 
Last edited:
Upvote 0
Top