SourceForge has been redesigned. Learn more.


  • Gary Harris

    Gary Harris - 2011-01-13

    I'm wondering how to do the equivalent of wxColourPropertyValueFromVariant() and wxColourPropertyValueToVariant() in the version implemented in WX2.9. That implementation lacks these functions in the generic classes. I've tried all sorts of things across several days of trying, casting, importing old code from advprops.h, etc with no luck. Is there a way to do this?


  • Jaakko Salli

    Jaakko Salli - 2011-01-13

    wxPropertyGrid now uses the same system as the other wxVariant types not natively implemented in variant.cpp. For example:

    wxColourPropertyValue col;
    wxVariant variant = prop->GetValue();
    col << variant;
    variant << col;

    There should be more info in the wxVariant documentation. You can also use the new template-based wxAny class, which should be handier in most cases (note: GetValue() only returns wxVariant, but it is implicitly converted to wxAny in the example):

        wxAny value = prop->GetValue();
        wxColourPropertyValue col = value.As<wxColourPropertyValue>();
  • Jaakko Salli

    Jaakko Salli - 2011-01-13

    Sorry, I may have spoken too soon about wxVariant<->wxAny conversion support. I actually think it only works for built-in types and some native wxWidgets compound types.


Log in to post a comment.