TComboBox:bCloseUp doesn't work

Post Reply
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

TComboBox:bCloseUp doesn't work

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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 )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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" ) } 
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply