+
+static long sLastTypeIn = 0 ;
+
+void wxListBox::OnChar(wxKeyEvent& event)
+{
+ EventRecord *ev = (EventRecord*) (wxTheApp->MacGetCurrentEvent() ) ;
+ short keycode ;
+ short keychar ;
+ keychar = short(ev->message & charCodeMask);
+ keycode = short(ev->message & keyCodeMask) >> 8 ;
+ if ( event.KeyCode() == WXK_SPACE )
+ {
+ wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
+ event.SetEventObject( this );
+
+ wxArrayInt aSelections;
+ int n, count = GetSelections(aSelections);
+ if ( count > 0 )
+ {
+ n = aSelections[0];
+ if ( HasClientObjectData() )
+ event.SetClientObject( GetClientObject(n) );
+ else if ( HasClientUntypedData() )
+ event.SetClientData( GetClientData(n) );
+ event.SetString( GetString(n) );
+ }
+ else
+ {
+ n = -1;
+ }
+
+ event.m_commandInt = n;
+
+ GetEventHandler()->ProcessEvent(event);
+ }
+ else if ( event.KeyCode() == WXK_DOWN || event.KeyCode() == WXK_UP )
+ {
+ // default handling
+ event.Skip() ;
+// ::HandleControlKey( (ControlHandle) m_macControl , keycode , keychar , ev->modifiers ) ;
+ }
+ else
+ {
+ if ( ev->when > m_lastTypeIn + 60 )
+ {
+ m_typeIn = "" ;
+ }
+ m_lastTypeIn = ev->when ;
+ m_typeIn += (char) event.KeyCode() ;
+ int line = FindString("*"+m_typeIn+"*") ;
+ if ( line >= 0 )
+ {
+ SetSelection(line) ;
+ }
+ }
+}
+