User Interface advice

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Raoul Watson

    #1

    User Interface advice

    I am looking for some advise on user interface related to the date picker
    control.

    I have a user form with a date picker associated to a database. The date
    picker has a meeting date, however, not every record has this date set (i.e.
    some record has no meeting date).

    Unfortunately, the date picker when not set to any particular date, would
    display whatever date the control was created. Even when the control is
    disabled, this shows. I can't find a way to make this control "blank".

    I have use a regular text box and move the date into it but it becomes
    cumbersome code-wise when you have multiple date pickers on the screen.

    Would anyone have a suggestion how to handle this?

    Any advise is greatly appreciated. Thanks and God Bless.
    _Raoul


  • Rick Rothstein

    #2
    Re: User Interface advice

    >I am looking for some advise on user interface related to the date picker
    control.
    >
    I have a user form with a date picker associated to a database. The date
    picker has a meeting date, however, not every record has this date set
    (i.e.
    some record has no meeting date).
    >
    Unfortunately, the date picker when not set to any particular date, would
    display whatever date the control was created. Even when the control is
    disabled, this shows. I can't find a way to make this control "blank".
    >
    I have use a regular text box and move the date into it but it becomes
    cumbersome code-wise when you have multiple date pickers on the screen.
    >
    Would anyone have a suggestion how to handle this?
    I'm not sure what you mean by "a date picker associated to a database"... if
    you mean it is bound to a database, then I am not sure if the following can
    be made to work or not (I never bind controls to databases directly);
    however, if you are interrogating the database and then attempting to set
    the initial display in the DatePicker control, then you can definitely make
    use of the following...

    From a previous post of mine...

    Put the code which appears after my name in the Form's code window and see
    if it does what you want. When you want to blank the DatePicker control
    within code, say using a CommandButton, put this in its Click event.

    Private Sub Command1_Click( )
    DTPicker1.Value = vbNull
    FormatDTPicker
    End Sub

    Once you execute the above, the text field for the DatePicker control will
    be blanked out; however, the drop-down calendar will still display today's
    date when dropped down (there is no way to "blank" the monthly display that
    I know of).

    Rick

    ' Place the following code into the form's code window
    '
    Private Sub DTPicker1_Close Up()
    FormatDTPicker
    End Sub

    Private Sub DTPicker1_Forma t(ByVal CallbackField As String, _
    FormattedString As String)
    If CallbackField = "X" Then
    FormattedString = ""
    End If
    End Sub

    Private Sub FormatDTPicker( )
    With DTPicker1
    If .Value = vbNull Then
    .Format = dtpCustom
    .CustomFormat = "X"
    Else
    .Format = dtpShortDate
    End If
    End With
    End Sub

    Private Sub DTPicker1_Mouse Down(Button As Integer, _
    Shift As Integer, X As Single, Y As Single)
    With DTPicker1
    If .Value = vbNull Then
    .Value = Now
    End If
    End With
    End Sub


    Comment

    • Steve Gerrard

      #3
      Re: User Interface advice


      "Rick Rothstein" <rickNOSPAMnews @NOSPAMcomcast. netwrote in message
      news:1bCdnUbMqd vXn0vZnZ2dnUVZ_ vqdnZ2d@comcast .com...
      >I have a user form with a date picker associated to a database. The date
      >picker has a meeting date, however, not every record has this date set (i.e.
      >some record has no meeting date).
      >>
      >Unfortunatel y, the date picker when not set to any particular date, would
      >display whatever date the control was created. Even when the control is
      >disabled, this shows. I can't find a way to make this control "blank".
      >>
      >
      I'm not sure what you mean by "a date picker associated to a database"... if
      you mean it is bound to a database, then I am not sure if the following can be
      made to work or not (I never bind controls to databases directly); however, if
      you are interrogating the database and then attempting to set the initial
      display in the DatePicker control, then you can definitely make use of the
      following...
      (code snipped)
      Same idea, different arrangement. This one might work better for a data-bound
      date picker, since it does not need a call to "FormatDTPicker "; it will work off
      of the built in format events. Note that the keyboard shortcuts for changing the
      date won't work, however.

      Const PickerFormat As String = "MMM dd, yyyy"

      Private Sub Form_Load()
      DTPicker1.Check Box = True
      DTPicker1.Custo mFormat = "X"
      DTPicker1.Forma t = dtpCustom
      End Sub

      Private Sub DTPicker1_Forma t(ByVal CallbackField As String, FormattedString As
      String)
      FormattedString = GetDateString(D TPicker1)
      End Sub

      Private Sub DTPicker1_Forma tSize(ByVal CallbackField As String, Size As Integer)
      Size = Len(PickerForma t)
      End Sub

      Private Function GetDateString(P icker As DTPicker) As String
      With Picker
      If IsNull(.Value) Then
      GetDateString = ""
      Else
      GetDateString = Format(.Value, PickerFormat)
      End If
      End With
      End Function



      Comment

      • Raoul Watson

        #4
        Re: User Interface advice


        "Steve Gerrard" <mynamehere@com cast.netwrote in message
        news:_OGdnSkPqv dtvUvZnZ2dnUVZ_ rudnZ2d@comcast .com...
        >
        "Rick Rothstein" <rickNOSPAMnews @NOSPAMcomcast. netwrote in message
        news:1bCdnUbMqd vXn0vZnZ2dnUVZ_ vqdnZ2d@comcast .com...
        Thank you Rick and Steve. I can use either method but prefer Steve's since
        it doesn't add a checkbox to the control. Thanks again, I've learned
        something new about DTPicker today..


        Comment

        • Rick Rothstein

          #5
          Re: User Interface advice

          Thank you Rick and Steve. I can use either method
          but prefer Steve's since it doesn't add a checkbox
          to the control. Thanks again, I've learned something
          new about DTPicker today..
          Personally, I don't mind which of our methods you use since the important
          thing is for you to find one that get the job done; but I am confused by
          your posting... the method I posted does not require a CheckBox to be added
          (nor did I even mention the word CheckBox in my response) whereas I see in
          Steve's code a line that sets the CheckBox property to True (although I'm
          not sure if that is a requirement for the rest of his code to be able to
          work or not). Anyway, I'm glad you learned something new about ht DatePicker
          control... hopefully you will find ways to expand on what you learned and
          provide your programs with even more functionality in the future.

          Rick


          Comment

          • Steve Gerrard

            #6
            Re: User Interface advice


            "Rick Rothstein" <rickNOSPAMnews @NOSPAMcomcast. netwrote in message
            news:acGdnckxRN jh-kvZnZ2dnUVZ_oWd nZ2d@comcast.co m...
            >Thank you Rick and Steve. I can use either method
            >but prefer Steve's since it doesn't add a checkbox
            >to the control. Thanks again, I've learned something
            >new about DTPicker today..
            >
            Personally, I don't mind which of our methods you use since the important
            thing is for you to find one that get the job done; but I am confused by your
            posting... the method I posted does not require a CheckBox to be added (nor
            did I even mention the word CheckBox in my response) whereas I see in Steve's
            code a line that sets the CheckBox property to True (although I'm not sure if
            that is a requirement for the rest of his code to be able to work or not).
            Anyway, I'm glad you learned something new about ht DatePicker control...
            hopefully you will find ways to expand on what you learned and provide your
            programs with even more functionality in the future.
            >
            Rick
            >
            My DTPicker control doesn't allow assigning Null to the Value property unless
            the CheckBox property is true, which does cause it to display a checkbox. It is
            version 6, SP6, running in VB6.

            The only advantage of my method is that it can be used for bound controls;
            otherwise I think Rick's is more flexible.



            Comment

            • Raoul Watson

              #7
              Re: User Interface advice


              "Rick Rothstein" <rickNOSPAMnews @NOSPAMcomcast. netwrote in message
              news:acGdnckxRN jh-kvZnZ2dnUVZ_oWd nZ2d@comcast.co m...
              >.. but I am confused by
              your posting... the method I posted does not require a CheckBox to be
              added
              (nor did I even mention the word CheckBox in my response) whereas I see in
              The confusion is all mine.. sorry.. I attributed it to age if one can't even
              differentiate between the two names he just read a couple of minutes before
              :-)


              Comment

              Working...