ComboBox drop-down window closing/hidden

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • - HAL9000

    ComboBox drop-down window closing/hidden

    I am trying to get an event when the drop-down Combo Box goes away /
    reverts back to showing a single item.

    For example, clicking the box's down arrow, to remove the drop-down
    window, doesn't seem to generate any event. Not even a mouse event.
    That seems a little odd.

    Besides not finding a public event method, I can't seem to find a
    protected method to over-ride either.

    I am guessing I need to look for a message in ComboBox's WndProc().
    But I don't know which message is the one I'm looking for.

    Any ideas ?

    Thanks...


  • kimiraikkonen

    #2
    Re: ComboBox drop-down window closing/hidden

    On Mar 21, 10:00 am, - HAL9000 <gu...@mail.org wrote:
    I am trying to get an event when the drop-down Combo Box goes away /
    reverts back to showing a single item.
    >
    For example, clicking the box's down arrow, to remove the drop-down
    window, doesn't seem to generate any event. Not even a mouse event.
    That seems a little odd.
    >
    Besides not finding a public event method, I can't seem to find a
    protected method to over-ride either.
    >
    I am guessing I need to look for a message in ComboBox's WndProc().
    But I don't know which message is the one I'm looking for.
    >
    Any ideas ?
    >
    Thanks...
    DropDownClosed event of combobox must be what you're looking for.

    Comment

    • - HAL9000

      #3
      Re: ComboBox drop-down window closing/hidden

      On Fri, 21 Mar 2008 02:32:01 -0700 (PDT), kimiraikkonen
      <kimiraikkonen8 5@gmail.comwrot e:
      >On Mar 21, 10:00 am, - HAL9000 <gu...@mail.org wrote:
      >I am trying to get an event when the drop-down Combo Box goes away /
      >reverts back to showing a single item.
      >>
      >For example, clicking the box's down arrow, to remove the drop-down
      >window, doesn't seem to generate any event. Not even a mouse event.
      >That seems a little odd.
      >>
      >Besides not finding a public event method, I can't seem to find a
      >protected method to over-ride either.
      >>
      >I am guessing I need to look for a message in ComboBox's WndProc().
      >But I don't know which message is the one I'm looking for.
      >>
      >Any ideas ?
      >>
      >Thanks...
      >
      >DropDownClos ed event of combobox must be what you're looking for.
      Ahh, I see they added DropDownClosed( ) event for .net version 2. I
      have to use version 1, so I can't use that.

      That tip did lead me to the information I needed though (eg
      CBN_CLOSEUP message):




      Changed that around a little to:

      Protected Overrides Sub WndProc(ByRef m As
      System.Windows. Forms.Message)
      'WM_USER As Integer = &H400
      'OCM__BASE As Integer = WM_USER + &H1C00
      'WM_COMMAND As Integer = &H111
      'OCM_COMMAND As Integer = OCM__BASE + WM_COMMAND
      If m.Msg = (&H400 + &H111 + &H1C00) Then
      Debug.WriteLine ("WndProc Msg = " & Hex(m.Msg) & "h, LParam =
      " & Hex(m.LParam.To Int32) & "h, WParam = " & Hex(m.WParam.To Int32) &
      "h, HWnd = " & Hex(m.HWnd.ToIn t32) & "h")
      If (m.WParam.ToInt 32 And &HF0000) = &H80000 Then
      Debug.WriteLine ("drop down window close message")
      OnDropDownWindo wClose(System.E ventArgs.Empty)
      End If
      End If
      MyBase.WndProc( m)
      End Sub

      Protected Overridable Sub OnDropDownWindo wClose(ByVal e As
      System.EventArg s)
      RaiseEvent DropDownWindowC lose(Me, e)
      End Sub

      Public Event DropDownWindowC lose As EventHandler



      Comment

      • kimiraikkonen

        #4
        Re: ComboBox drop-down window closing/hidden

        On Mar 21, 11:21 pm, - HAL9000 <gu...@mail.org wrote:
        On Fri, 21 Mar 2008 02:32:01 -0700 (PDT), kimiraikkonen
        >
        >
        >
        >
        >
        <kimiraikkone.. .@gmail.comwrot e:
        On Mar 21, 10:00 am, - HAL9000 <gu...@mail.org wrote:
        I am trying to get an event when the drop-down Combo Box goes away /
        reverts back to showing a single item.
        >
        For example, clicking the box's down arrow, to remove the drop-down
        window, doesn't seem to generate any event.  Not even a mouse event.
        That seems a little odd.
        >
        Besides not finding a public event method, I can't seem to find a
        protected method to over-ride either.
        >
        I am guessing I need to look for a message in ComboBox's WndProc().
        But I don't know which message is the one I'm looking for.
        >
        Any ideas ?
        >
        Thanks...
        >
        DropDownClosed event of combobox must be what you're looking for.
        >
        Ahh, I see they added DropDownClosed( ) event for .net version 2.  I
        have to use version 1, so I can't use that.
        >
        That tip did lead me to the information I needed though (eg
        CBN_CLOSEUP message):
        >
        http://groups.google.com/group/micro...languages.vb/m...
        >
        Changed that around a little to:
        >
           Protected Overrides Sub WndProc(ByRef m As
        System.Windows. Forms.Message)
              'WM_USER As Integer = &H400
              'OCM__BASE As Integer = WM_USER + &H1C00
              'WM_COMMAND As Integer = &H111
              'OCM_COMMAND As Integer = OCM__BASE + WM_COMMAND
              If m.Msg = (&H400 + &H111 + &H1C00) Then
                 Debug.WriteLine ("WndProc Msg = " & Hex(m.Msg) & "h, LParam =
        " & Hex(m.LParam.To Int32) & "h, WParam = " & Hex(m.WParam.To Int32) &
        "h, HWnd = " & Hex(m.HWnd.ToIn t32) & "h")
                 If (m.WParam.ToInt 32 And &HF0000) = &H80000 Then
                    Debug.WriteLine ("drop down window close message")
                    OnDropDownWindo wClose(System.E ventArgs.Empty)
                 End If
              End If
              MyBase.WndProc( m)
           End Sub
        >
           Protected Overridable Sub OnDropDownWindo wClose(ByVal e As
        System.EventArg s)
              RaiseEvent DropDownWindowC lose(Me, e)
           End Sub
        >
           Public Event DropDownWindowC lose As EventHandler- Hide quoted text -
        >
        - Show quoted text -
        I think it's your time to jump .net 2.0 at least. DropDownClosed is
        well-wrapped event rather than writing low-level Win32 API calls as
        you described above.

        Comment

        Working...