Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#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".

Discussion


  • Anonymous
    2011-08-13

    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)).

     

  • Anonymous
    2011-08-13

    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.

     
  • MaskedRaider
    MaskedRaider
    2011-10-07

    Any updates on this?

     
  • MaskedRaider
    MaskedRaider
    2011-10-07

    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.