RFE: GetClientData on MSW platforms

Hi!

I have a request for enhancement for wxPython when running on MS Windows
(any version, I believe, but I tested on 98 and XP only) with regards to
the methods GetClientData for wxChoice and wxComboBox.

I'm running the latest stable release -- 2.4.2.4 -- on both Linux and
Windows. If I have a

   self.anychoicebox.Clear()
   self.anychoicebox.Append('')
   cd = self.anychoicebox.GetClientData(0)
   if cd:
      print cd

I get an error saying that there's no ClientData for that object when
running on Windows. When running on Linux, I think wxGTK returns 'None'
since I have no problem with the above snippet of code.

I'd like to have the same behaviour on both platforms. For now, as a
workaround, I'm doing "Append('', None)". It would be really nice if
the GetClientData returned None when it couldn't get any information.

Is it a plausible request? Is it doable for the stable versions of
wxPython? Is it fixed in the development (2.5) series?

Thanks in advance,

···

--
Godoy. <godoy@ieee.org>

Jorge Godoy wrote:

Hi!

I have a request for enhancement for wxPython when running on MS Windows
(any version, I believe, but I tested on 98 and XP only) with regards to
the methods GetClientData for wxChoice and wxComboBox.

I'm running the latest stable release -- 2.4.2.4 -- on both Linux and
Windows. If I have a

   self.anychoicebox.Clear()
   self.anychoicebox.Append('')
   cd = self.anychoicebox.GetClientData(0)
   if cd:
      print cd

I get an error saying that there's no ClientData for that object when
running on Windows. When running on Linux, I think wxGTK returns 'None'
since I have no problem with the above snippet of code.

I'd like to have the same behaviour on both platforms. For now, as a
workaround, I'm doing "Append('', None)". It would be really nice if
the GetClientData returned None when it couldn't get any information.

Is it a plausible request? Is it doable for the stable versions of
wxPython? Is it fixed in the development (2.5) series?

The good news is that they are consistent in 2.5. The bad news is that they both raise an exception. The reasoning is that None can be a valid data object, not an error return indicator.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn <robin@alldunn.com> writes:

The good news is that they are consistent in 2.5. The bad news is that
they both raise an exception. The reasoning is that None can be a valid
data object, not an error return indicator.

That consistent behaviour is perfect to me. I have already changed all
the code to include 'None' :slight_smile:

The problem was the inconsistent behaviour. The 'None' by default was
just a lazy (to me) solution.

Thanks,

···

--
Godoy. <godoy@ieee.org>