iOS Question How do I dynamically create a date picker?

Discussion in 'iOS Questions' started by davepamn, Feb 24, 2015.

  1. davepamn

    davepamn Active Member Licensed User

    I need to dynamically create a date picker for a scrollview and then initialize it with a parameter date.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Code:
    Dim dp As DatePicker
    dp.Initialize(
    "dp")
    dp.Ticks = 
    DateTime.Now
    Page1.RootPanel.AddView(dp,
    00100%x200)
     
  3. davepamn

    davepamn Active Member Licensed User

    How do I set the date picker using mm/dd/yyyy?

    Do you have a function that converts a date into ticks
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread for this question.
     
  5. davepamn

    davepamn Active Member Licensed User

    Code:
    Dim arrDatePicker(100As DatePicker

        arrDatePicker(iDatePickerCounter).Mode=arrDatePicker(iDatePickerCounter).MODE_DATE
        
    DateTime.DateFormat = "MM/dd/yyyy"
        arrDatePicker(iDatePickerCounter).Ticks=
    DateTime.DateParse(sTestIdValue)
    This code worked! I was able to set a date and format to Month, Day, and Year in the Picker Control
     
  6. davepamn

    davepamn Active Member Licensed User

    this snippet reverses the ticks to a date
    Code:
    sTestValue=GetDate(arrDatePicker(i).ticks)

    Public Sub GetDate(Ticks As Long) As String

        
    Dim df As String = DateTime.DateFormat

        
    DateTime.DateFormat = "MM/dd/yyyy"

        
    Dim res As String = DateTime.Date(Ticks)

        
    DateTime.DateFormat = df

        
    Return res

    End Sub
     
  7. gjoisa

    gjoisa Active Member Licensed User

    How to dismiss the picker after setting the required date ?
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    The picker cannot be dismissed. You can remove it like you remove any view (dp.RemoveFromParent).
     
  9. gjoisa

    gjoisa Active Member Licensed User

    In other applications there will be done button to dismiss the picker in Iphone . In Ipad if we touch the out side area of picker it will be dismissed . How the do that ?
     
  10. Erel

    Erel Administrator Staff Member Licensed User

    You can handle the Page_Click event and call Page.ResignFocus.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice