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

#20 Custom text for boolean properties

closed
Jaakko Salli
None
3
2009-10-07
2009-10-01
madnut_ua
No

Could it be posssible to add ability to assign custom text to bool property values, e.g. "Enabled", "Disabled" instead of default "True", "False" (or "Working", "Stopped"; "Male", "Female" and so on). It also should be translatable.

Discussion

  • madnut_ua
    madnut_ua
    2009-10-01

    • priority: 5 --> 7
    • assigned_to: nobody --> jmsalli
     
  • Jaakko Salli
    Jaakko Salli
    2009-10-01

    Do you mean globally, or on a property basis? There is already way to change bool choices globally using wxPropertyGridInterface::SetBoolChoices().

    Also, this should be trivial for you to implement by simply using wxEnumProperty instead of wxBoolProperty, so this is really not a high-priority issue.

     
  • Jaakko Salli
    Jaakko Salli
    2009-10-01

    • priority: 7 --> 3
     
  • madnut_ua
    madnut_ua
    2009-10-01

    Ok, thanks for advice. I'll try one of your tips until ticket isn't implemented.

     
  • Jaakko Salli
    Jaakko Salli
    2009-10-07

    Since this should be quite trivial to implement efficiently with wxEnumProperty, I'm not going to add this feature (unless somebody else requests it as well).

    Here's a snippet that should pretty much work:

    // Let's prepare our custom bool choices
    wxPGChoices myBoolChoices;
    myBoolChoices.Add(wxT("Enabled"), 1);
    myBoolChoices.Add(wxT("Disabled"), 0);

    // Store custom choices
    m_myBoolChoices = myBoolChoices;

    // Add new property with our choices
    pg->Append( wxEnumProperty(proplabel, propname, m_myBoolChoices, int(myBoolValue)) );

    // Get bool value from property
    bool myBoolValue = pg->GetPropertyValue(propname).GetLong() ? true : false;

     
  • Jaakko Salli
    Jaakko Salli
    2009-10-07

    • status: open --> closed