Page 1 of 1

TComboBox:bCloseUp doesn't work

Posted: Thu Feb 16, 2006 11:30 am
by Enrico Maria Giordano
This is the sample. I hear no beep when the dropdownlist is closed. Am I missing something?

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL oCbx, cVar := SPACE( 20 )

    DEFINE DIALOG oDlg

    @ 1, 1 COMBOBOX oCbx VAR cVar;
           ITEMS { "First", "Second", "Third" };
           STYLE CBS_DROPDOWN

    oCbx:bCloseUp = { || Tone( 440, 1 ) }

    @ 3, 1 BUTTON "&Close" ACTION oDlg:End()

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL
EMG

Re: TComboBox:bCloseUp doesn't work

Posted: Tue Feb 21, 2006 9:11 am
by Enrico Maria Giordano
And I can't close the DIALOG using ESC key when the focus is on the combobox.

EMG

Posted: Tue Feb 21, 2006 7:07 pm
by Antonio Linares
Enrico,

This fix solves the ESC close bug:

Code: Select all

METHOD KeyChar( nKey, nFlags ) CLASS TComboBox

   if nKey == VK_RETURN
      return ::oWnd:GoNextCtrl( ::hWnd )
   endif
   
return Super:KeyChar( nKey, nFlags )

Posted: Tue Feb 21, 2006 7:09 pm
by Enrico Maria Giordano
Thank you. And what about the bCloseUp problem?

EMG

Posted: Tue Feb 21, 2006 7:24 pm
by Antonio Linares
Enrico,

These changes are required for the CloseUp event fix:

In dialog.prg:

Code: Select all

#define CBN_CLOSEUP        8
...
METHOD Command( nWParam, nLParam ) CLASS TDialog
   ...
              case nNotifyCode == CBN_SELCHANGE
                   SendMessage( hWndCtl, FM_CHANGE, 0, 0 )

              case nNotifyCode == CBN_CLOSEUP // New! 
                   SendMessage( hWndCtl, FM_CLOSEUP, 0, 0 )
In combobox.prg:

Code: Select all

METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TComboBox

   if nMsg == FM_CLOSEUP
      return ::CloseUp()
   endif
   
return Super:HandleEvent( nMsg, nWParam, nLParam )      
In your sample change this:

Code: Select all

    oCbx:bCloseUp = { || MsgInfo( "CloseUp Event" ) } 

Posted: Tue Feb 21, 2006 8:02 pm
by Enrico Maria Giordano
Thank you!

EMG