]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/choice.cpp
compilation fix
[wxWidgets.git] / src / msw / choice.cpp
index ee3e51151530d732f56d03b2b2596c8919f50d27..0f7d86ec3bca2c99dc17f276a4b23330169fea14 100644 (file)
@@ -85,6 +85,13 @@ bool wxChoice::Create(wxWindow *parent,
     return TRUE;
 }
 
+/*
+wxChoice::~wxChoice()
+{
+    Free();
+}
+*/
+
 // ----------------------------------------------------------------------------
 // adding/deleting items to/from the list
 // ----------------------------------------------------------------------------
@@ -113,6 +120,14 @@ void wxChoice::Delete(int n)
 }
 
 void wxChoice::Clear()
+{
+//    Free();
+
+    SendMessage(GetHwnd(), CB_RESETCONTENT, 0, 0);
+}
+
+/*
+void wxChoice::Free()
 {
     if ( HasClientObjectData() )
     {
@@ -122,9 +137,8 @@ void wxChoice::Clear()
             delete GetClientObject(n);
         }
     }
-
-    SendMessage(GetHwnd(), CB_RESETCONTENT, 0, 0);
 }
+*/
 
 // ----------------------------------------------------------------------------
 // selection
@@ -216,7 +230,7 @@ void* wxChoice::DoGetItemClientData( int n ) const
         wxLogLastError(wxT("CB_GETITEMDATA"));
 
         // unfortunately, there is no way to return an error code to the user
-       rc = (LPARAM) NULL;
+        rc = (LPARAM) NULL;
     }
 
     return (void *)rc;
@@ -307,10 +321,15 @@ bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
         return FALSE;
     }
 
+    int n = GetSelection();
     wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId);
-    event.SetInt(GetSelection());
+    event.SetInt(n);
     event.SetEventObject(this);
     event.SetString(GetStringSelection());
+    if ( HasClientObjectData() )
+        event.SetClientObject( GetClientObject(n) );
+    else if ( HasClientUntypedData() )
+        event.SetClientData( GetClientData(n) );
     ProcessCommand(event);
 
     return TRUE;