Drop down a DTPicker from code?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 11 of 11

Thread: Drop down a DTPicker from code?

  1. #1
    David Crowell Guest

    Drop down a DTPicker from code?

    Is there a method to drop down a DateTime Picker from code?

    I assume that it'll be a SendMessage call, but I have no idea what message
    to send. Any help would be appreciated.

    Thanks,

    Dave




  2. #2
    Tom Esh Guest

    Re: Drop down a DTPicker from code?

    On Fri, 24 Nov 2000 11:40:50 -0500, "David Crowell"
    <dc_work@yahoo.com> wrote:
    >Is there a method to drop down a DateTime Picker from code?...


    Unfortunately, no direct way. However it's fairly simple to fake a
    mouse click on the dropdown arrow button with mouse_event.


    -Tom
    (please post replies to the newsgroup)

  3. #3
    Tom Esh Guest

    Re: Drop down a DTPicker from code?

    On Fri, 24 Nov 2000 11:40:50 -0500, "David Crowell"
    <dc_work@yahoo.com> wrote:
    >Is there a method to drop down a DateTime Picker from code?...


    Unfortunately, no direct way. However it's fairly simple to fake a
    mouse click on the dropdown arrow button with mouse_event.


    -Tom
    (please post replies to the newsgroup)

  4. #4
    David Crowell Guest

    Re: Drop down a DTPicker from code?

    Using SPY++ I found that the DTP does not have a child buttion, but I was
    able to get this to work with the following kludge...


    Option Explicit

    Private Const WM_LBUTTONDOWN As Long = &H201
    Private Const WM_LBUTTONUP As Long = &H202
    Private Const MK_LBUTTON = &H1

    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
    (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As
    Any) As Long

    Public Sub DropDTPicker(dtp As Object)

    Dim Pos As Long

    Pos = ((dtp.Width / Screen.TwipsPerPixelX) - 5) Or &H50000

    SendMessage dtp.hwnd, WM_LBUTTONDOWN, MK_LBUTTON, ByVal Pos
    SendMessage dtp.hwnd, WM_LBUTTONUP, MK_LBUTTON, ByVal Pos

    End Sub

    Dave
    www.davidcrowell.com


    "Tom Esh" <tjeshGibberish@blazenet.net> wrote in message
    news:3a1ebc97.35338118@news.devx.com...
    > On Fri, 24 Nov 2000 11:40:50 -0500, "David Crowell"
    > <dc_work@yahoo.com> wrote:
    > >Is there a method to drop down a DateTime Picker from code?...

    >
    > Unfortunately, no direct way. However it's fairly simple to fake a
    > mouse click on the dropdown arrow button with mouse_event.
    >
    >
    > -Tom
    > (please post replies to the newsgroup)




  5. #5
    David Crowell Guest

    Re: Drop down a DTPicker from code?

    Using SPY++ I found that the DTP does not have a child buttion, but I was
    able to get this to work with the following kludge...


    Option Explicit

    Private Const WM_LBUTTONDOWN As Long = &H201
    Private Const WM_LBUTTONUP As Long = &H202
    Private Const MK_LBUTTON = &H1

    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
    (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As
    Any) As Long

    Public Sub DropDTPicker(dtp As Object)

    Dim Pos As Long

    Pos = ((dtp.Width / Screen.TwipsPerPixelX) - 5) Or &H50000

    SendMessage dtp.hwnd, WM_LBUTTONDOWN, MK_LBUTTON, ByVal Pos
    SendMessage dtp.hwnd, WM_LBUTTONUP, MK_LBUTTON, ByVal Pos

    End Sub

    Dave
    www.davidcrowell.com


    "Tom Esh" <tjeshGibberish@blazenet.net> wrote in message
    news:3a1ebc97.35338118@news.devx.com...
    > On Fri, 24 Nov 2000 11:40:50 -0500, "David Crowell"
    > <dc_work@yahoo.com> wrote:
    > >Is there a method to drop down a DateTime Picker from code?...

    >
    > Unfortunately, no direct way. However it's fairly simple to fake a
    > mouse click on the dropdown arrow button with mouse_event.
    >
    >
    > -Tom
    > (please post replies to the newsgroup)




  6. #6
    Karl E. Peterson Guest

    Re: Drop down a DTPicker from code?

    Hi Dave --

    > Is there a method to drop down a DateTime Picker from code?


    SendKeys "{F4}" (or equivalent WM_KEYDOWN/WM_KEYUP messages).

    Later... Karl
    --
    http://www.mvps.org/vb




  7. #7
    Karl E. Peterson Guest

    Re: Drop down a DTPicker from code?

    Hi Dave --

    > Is there a method to drop down a DateTime Picker from code?


    SendKeys "{F4}" (or equivalent WM_KEYDOWN/WM_KEYUP messages).

    Later... Karl
    --
    http://www.mvps.org/vb




  8. #8
    David Crowell Guest

    Re: Drop down a DTPicker from code?

    I had no idea that F4 would drop down a DTPicker... who thought of that
    one...

    Dave

    "Karl E. Peterson" <karl@mvps.org> wrote in message
    news:3a31838c$1@news.devx.com...
    > Hi Dave --
    >
    > > Is there a method to drop down a DateTime Picker from code?

    >
    > SendKeys "{F4}" (or equivalent WM_KEYDOWN/WM_KEYUP messages).
    >
    > Later... Karl
    > --
    > http://www.mvps.org/vb
    >
    >
    >




  9. #9
    David Crowell Guest

    Re: Drop down a DTPicker from code?

    I had no idea that F4 would drop down a DTPicker... who thought of that
    one...

    Dave

    "Karl E. Peterson" <karl@mvps.org> wrote in message
    news:3a31838c$1@news.devx.com...
    > Hi Dave --
    >
    > > Is there a method to drop down a DateTime Picker from code?

    >
    > SendKeys "{F4}" (or equivalent WM_KEYDOWN/WM_KEYUP messages).
    >
    > Later... Karl
    > --
    > http://www.mvps.org/vb
    >
    >
    >




  10. #10
    Karl E. Peterson Guest

    Re: Drop down a DTPicker from code?

    I was *really* pissed, myself, one day a few years ago, and just kept banging on keys
    until something worked. <g>
    --
    http://www.mvps.org/vb


    "David Crowell" <dave@davidcrowell.com> wrote in message
    news:3a318b6e@news.devx.com...
    > I had no idea that F4 would drop down a DTPicker... who thought of that
    > one...
    >
    > Dave
    >
    > "Karl E. Peterson" <karl@mvps.org> wrote in message
    > news:3a31838c$1@news.devx.com...
    > > Hi Dave --
    > >
    > > > Is there a method to drop down a DateTime Picker from code?

    > >
    > > SendKeys "{F4}" (or equivalent WM_KEYDOWN/WM_KEYUP messages).
    > >
    > > Later... Karl
    > > --
    > > http://www.mvps.org/vb
    > >
    > >
    > >

    >
    >



  11. #11
    Karl E. Peterson Guest

    Re: Drop down a DTPicker from code?

    I was *really* pissed, myself, one day a few years ago, and just kept banging on keys
    until something worked. <g>
    --
    http://www.mvps.org/vb


    "David Crowell" <dave@davidcrowell.com> wrote in message
    news:3a318b6e@news.devx.com...
    > I had no idea that F4 would drop down a DTPicker... who thought of that
    > one...
    >
    > Dave
    >
    > "Karl E. Peterson" <karl@mvps.org> wrote in message
    > news:3a31838c$1@news.devx.com...
    > > Hi Dave --
    > >
    > > > Is there a method to drop down a DateTime Picker from code?

    > >
    > > SendKeys "{F4}" (or equivalent WM_KEYDOWN/WM_KEYUP messages).
    > >
    > > Later... Karl
    > > --
    > > http://www.mvps.org/vb
    > >
    > >
    > >

    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center