1. Black Friday Sale - 50% off

    B4A Standard for $29 instead of $59!
    Buy Now
    Dismiss Notice

iOS Question Make dialog visible

Discussion in 'iOS Questions' started by asubias, Feb 28, 2019.

  1. asubias

    asubias Member Licensed User

    I made a B4XDialog that contains a DateTime Label. To change it I decided to make a DateTimeDialog based on this https://www.b4x.com/android/forum/threads/date-picker-snippet.84098/

    My problem is if i show another dialog the first one closes (that not happens on B4a).
    I tried reshowing the dialog but the wait for no longer works and I think i still having the older dialog in background.

    Is there any way to make visible again? The dialog.Visible is read only and Base.Visible returns True...

    Thank you in advance.
  2. Erel

    Erel Administrator Staff Member Licensed User

    Why not use the built-in B4XDateTemplate?

    Full example:
    Sub Process_Globals
    Public App As Application
    Public NavControl As NavigationController
    Private Page1 As Page
    Private Dialog As B4XDialog
    Private DateTemplate As B4XDateTemplate
    Private xui As XUI
    Private CustomDialogPanel As B4XView
    End Sub

    Private Sub Application_Start (Nav As NavigationController)
       NavControl = Nav
       Page1.Title = 
    "Page 1"
       Dialog.Title = 
       CustomDialogPanel = xui.CreatePanel(
    Dim btn As Button
    "btn", btn.STYLE_SYSTEM)
       btn.Text = 
    "Click to select date"
    End Sub

    Sub Page1_Click
    End Sub

    Sub ShowFirstDialog
    Wait For (Dialog.ShowCustom(CustomDialogPanel, "OK""""")) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
    Dim date As Long = CustomDialogPanel.Tag
           Page1.Title = 
    End If
    End Sub

    Sub btn_Click
    Do While Dialog.Visible
    Wait For (Dialog.ShowTemplate(DateTemplate, "OK""""")) Complete (Result As Int)
       CustomDialogPanel.Tag = DateTemplate.Date
    0).Text = DateTime.Date(DateTemplate.Date)
    End Sub
    asubias likes this.
  3. asubias

    asubias Member Licensed User

    Thanks Erel :)
    Because i need date and time and i like so much the iOS native datepicker desing.

    Looking at your code i understand that there is no way to make visible again a dialog. The only solution is reinvoke show function and call a new wait for?
  4. Erel

    Erel Administrator Staff Member Licensed User

    asubias likes this.
  5. asubias

    asubias Member Licensed User

    Ok, thank you Erel.
  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