/ Forums / Advansys Formativ / Creating Solutions with Formativ / DateTimePicker.Checked always returns true? / Reply To: DateTimePicker.Checked always returns true?

#6776
Support 1
Participant

    You are correct, and this is a bug. I have written a test applet that verifies this behaviour of .Checked with .ShowCheckBox = True. I have also noticed that setting .Checked = False in code makes no difference. Source code of my test applet is listed below.

    This issue has been recorded in the Formativ Bug Database. Our engineers will look at fixing this for the forthcoming release, version 2.

    '--------------------------------------------------------------------------------
    option explicit
    
    Sub Main(Client, GWEvent)
    
      dim iDialogResult
      dim iIsDone
      dim oControlDlg
      dim oDateTimePicker
      dim oLabel
    
      ' Create control box & controls...
      set oControlDlg = Utilities.NewControlBoxDialog
      oControlDlg.AutoSize = True
      oControlDlg.Caption = "My caption"
      oControlDlg.Title = "Configuration Settings"
      oControlDlg.Button1Caption = "OK"
      oControlDlg.Button2Caption = "Cancel"
    
      set oDateTimePicker = oControlDlg.AddDateTimeControl
      oDateTimePicker.ShowCheckBox = True
      oDateTimePicker.Date = Date
    
      set oLabel = oControlDlg.AddMultiLineLabelControl
    
      ' Execute the dialog until we're done...
      iIsDone = False
      Do
        iDialogResult = oControlDlg.Execute
        Select Case iDialogResult
          Case BTN1 ' OK
            if oDateTimePicker.Checked then
              oLabel.Caption = "Checked"
            else
              oLabel.Caption = "Not checked"
            end if
          Case BTN2 ' Cancel
            iIsDone = True
        End Select
      Loop Until iIsDone
    
      set oDateTimePicker = nothing
      set oLabel = nothing
      set oControlDlg = nothing
    
    End Sub
    '--------------------------------------------------------------------------------

    Advansys Support