Bug in wxToolbar?? [2.8.2, winXP, VC2005]

Vadim Zeitlin vadim at wxwindows.org
Wed Mar 28 11:35:08 PDT 2007


On Wed, 28 Mar 2007 18:32:30 +0200 Yaron Tadmor <YaronT at HumanEyes.com> wrote:

YT> I ran into something that looks like a small conceptual bug in PC port
YT> of WX (perhaps this manifests in others as well).
YT> The toolbar's tool ID's are noted as ints. On PC port these are 4-byte
YT> integers.
YT> 
YT> However, the PC implementation passes the ID in the WPARAM of the
YT> windows message. This means the ID is cast to a 2-byte integer which
YT> causes it to be truncated.

 Indeed.

YT> If indeed this IS a bug I can think of several ways to solve it:
YT> 1)	Change the API so it reflects the correct data size

 Unfortunately this won't be very helpful as C/C++ compilers happily cast
int to short implicitly anyhow.

YT> 2)	Add asserts on PC to make sure the ID's are in the correct
YT> range.

 Yes, this is the only thing to do. There is already such assert in
wxWindow::Create() so I guess it should be added to wxToolBarToolBase ctor
as well.

YT> 3)	Use a different parameter of the message to pass the proper ID.

 This is impossible as the native controls themselves use WPARAM to pass 

 Regards,
VZ

-- 
TT-Solutions: wxWidgets consultancy and technical support
               http://www.tt-solutions.com/





More information about the wx-users mailing list