#53 Canceled color dialog returns rgba (255,255,255,255)
open
nobody
None
5
2010-06-22
2010-06-22
Anonymous
No
WX.colorDialog returns Just (rgba (255,255,255,255)) when the Cancel button was pressed. But wxhaskell manual says: "Returns Nothing when Cancel was pressed".
1. colorIsOk function in WxcTypes.hs was assuming that invalid colour will have rgba < 0, but rgba is a Word, i.e. non-negative;
2. wxColour_IsOk function in eljcolour.cpp was returning a bool, but the foreign import in WxcTypes was expecting a CInt. This might work on platforms where sizeof(bool) == sizeof(int), but doesn't work e.g. on Windows under gcc, where sizeof(bool) == 1.
I couldn't figure out how to attach a patch to this ticket so sent it to the devel mailing list.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
At least on Linux, the color dialog does not show an alpha channel. So, the temporary workaround is to use the `colorAlpha' function to check if the resulting color's alpha is not 0.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
Testing with current darcs tip (0.13.1) and wx 2.8 on Windows, the behaviour is different: pressing cancel results in Just (rgba (0,0,0,0)).
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
There have been two issues around this:
1. colorIsOk function in WxcTypes.hs was assuming that invalid colour will have rgba < 0, but rgba is a Word, i.e. non-negative;
2. wxColour_IsOk function in eljcolour.cpp was returning a bool, but the foreign import in WxcTypes was expecting a CInt. This might work on platforms where sizeof(bool) == sizeof(int), but doesn't work e.g. on Windows under gcc, where sizeof(bool) == 1.
I couldn't figure out how to attach a patch to this ticket so sent it to the devel mailing list.
Any updates on this?
At least on Linux, the color dialog does not show an alpha channel. So, the temporary workaround is to use the `colorAlpha' function to check if the resulting color's alpha is not 0.