Recent Posts

Pages: [1] 2 3 4 5 6 ... 10
1
Hi, I use some my own defined wxWidgets control from time to time. When I try to add this custom control in the wxSmith GUI designer, you can select the "Custom" control, and define the constructor yourself.

Is this the case I describe above?
2
I looked at some source code here:

\src\plugins\contrib\wxSmith\wxwidgets\properties\wxscolourproperty.cpp

I see some function get override, such as:

Code
    // This is based on the code of wxSystemColourProperty in advprops.h|cpp of wxPropertyGrid
    class wxsMyColourPropertyClass : public wxEnumProperty
    {
        WX_PG_DECLARE_PROPERTY_CLASS(wxsMyColourPropertyClass)
    public:

        wxsMyColourPropertyClass( const wxString& label = wxEmptyString,
                                const wxString& name = wxPG_LABEL,
                                const wxColourPropertyValue& value = wxColourPropertyValue(wxsCOLOUR_DEFAULT,*wxWHITE) );
        ~wxsMyColourPropertyClass();

        virtual void OnSetValue();
        virtual bool IntToValue( wxVariant& variant, int number, int argFlags = 0 ) const;

        /** Override in derived class to customize how colours are printed as strings.
        */
        virtual wxString ColourToString( const wxColour& col, int index, int argFlags = 0 ) const;

        /** Returns index of entry that triggers colour picker dialog
            (default is last).
        */
        virtual int GetCustomColourIndex() const;

        virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
        virtual bool StringToValue( wxVariant& variant,
                                    const wxString& text,
                                    int argFlags = 0 ) const;

Do you mean that we need to add a special function overloading here?

See here:

https://docs.wxwidgets.org/3.3/classwx_p_g_property.html


I see VZ(wx developer) just close my issue, and he suggest that we need to override some functions myself.

Am I correct?



EDIT:

See this code in

https://github.com/wxWidgets/wxWidgets/blob/master/src/propgrid/advprops.cpp#L1102C1-L1182C2


Code
#if WXWIN_COMPATIBILITY_3_2
// By call to obsolete function we want to check if user-overriden function is still in use
wxString wxSystemColourProperty::ColourToStringWithCheck(const wxColour& col, int index,
                                                         wxPGPropValFormatFlags flags) const
{
    m_oldColourToStringCalled = false;
    wxString res = ColourToString(col, index, static_cast<int>(flags));
    if ( m_oldColourToStringCalled )
    {
        // Our own function was called - this implies that call was forwarded to the new overriding
        // function and there is no need to call it explicitly.
    }
    else
    {   // User-overriden obsolete function was called
        wxFAIL_MSG(wxString::Format("in %s use ColourToString with 'flags' argument as wxPGPropValFormatFlags", GetClassInfo()->GetClassName()));
    }
    return res;
}
#endif // WXWIN_COMPATIBILITY_3_2


wxString wxSystemColourProperty::ColourToString( const wxColour& col,
                                                 int index,
                                                 wxPGPropValFormatFlags flags ) const
{


    if ( index == wxNOT_FOUND )
    {


        if ( !!(flags & wxPGPropValFormatFlags::FullValue) || !!(m_flags & wxPGPropertyFlags_ColourHasAlpha) )
        {
            return wxString::Format(wxS("(%i,%i,%i,%i)"),
                                    (int)col.Red(),
                                    (int)col.Green(),
                                    (int)col.Blue(),
                                    (int)col.Alpha());
        }
        else
        {
            return wxString::Format(wxS("(%i,%i,%i)"),
                                    (int)col.Red(),
                                    (int)col.Green(),
                                    (int)col.Blue());
        }
    }
    else
    {
        return m_choices.GetLabel(index);
    }
}


wxString wxSystemColourProperty::ValueToString( wxVariant& value,
                                                wxPGPropValFormatFlags flags ) const
{
    wxColourPropertyValue val = GetVal(&value);


    int index;


    if ( !!(flags & wxPGPropValFormatFlags::ValueIsCurrent) )
    {
        // GetIndex() only works reliably if wxPGPropValFormatFlags::ValueIsCurrent flag is set,
        // but we should use it whenever possible.
        index = GetIndex();


        // If custom colour was selected, use invalid index, so that
        // ColourToString() will return properly formatted colour text.
        if ( index == GetCustomColourIndex() &&
             !(m_flags & wxPGPropertyFlags_HideCustomColour) )
            index = wxNOT_FOUND;
    }
    else
    {
        index = m_choices.Index(val.m_type);
    }


#if WXWIN_COMPATIBILITY_3_2
    // Special implementation with check if user-overriden obsolete function is still in use
    return ColourToStringWithCheck(val.m_colour, index, flags);
#else
    return ColourToString(val.m_colour, index, flags);
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
}


https://github.com/wxWidgets/wxWidgets/blob/8245e1073ae66fd246d2ec180160d2e20acf3644/interface/wx/propgrid/advprops.h#L92C1-L168C1

This is the header file.
3
Nightly builds / Re: The 06 December 2025 build (13761) is out.
« Last post by AndrewCot on Yesterday at 10:57:54 pm »
Whatever tool is used to create the compiler options checklist seems to fail when it encounters a mingw-w64 GCC compiler version that it does not "know", i.e.:
When the selected compiler is reverted to a compiler that the tool "knows" it does not go back to the checklist and stays with the blank tab.
As requested last year when you posted what looks like the same issue can you post instructions on how to re-create this and include the OS and CB version you are using.
4
Development / Re: wxSmith : add option for Create function in inhereited cases
« Last post by LR83 on Yesterday at 05:25:13 pm »
I try to add the option.
- Add m_Create property in wxsBaseProperties
- wxsItem::GetCreatePrefix, test the m_Create property. If false, I just add '//' before the Create function. So we can always see the parameters of the Create function (may be usefull).
Work for my project but I don't know if my solution is always good.
See the corrected files in the attachment.
5
I see that the propgrid sample in the wx3.3.1 works fine. So, maybe it is still something wrong inside our C::B code base?
6
Nightly builds / Re: The 06 December 2025 build (13761) is out.
« Last post by ChosenName on Yesterday at 12:03:05 pm »
Whatever tool is used to create the compiler options checklist seems to fail when it encounters a mingw-w64 GCC compiler version that it does not "know", i.e.:



When the selected compiler is reverted to a compiler that the tool "knows" it does not go back to the checklist and stays with the blank tab.
8
Yes, I agree, I see the call stack is not from the wxSmith's source code.

The problem is that if I can't open a wxSmith file in C::B, and we can't fix such issue in the C::B side, I have to revert to use wx 3.2.x to build C::B. I have already switched to use wx 3.3.1 in my github action to build C::B.
9
Help / Re: code::blocks hangs at startup
« Last post by killerbot on January 23, 2026, 05:49:17 pm »
@ChrisK , @blauzahn, @Lufex, @cet_ivan, @JorgenBest : would you be able to verify, if with the latest state of the code the problem is also gone on your side ?
10
In wxSmith there is only one call to wxPGProperty::GetValueAsString(), and it has no parameters. Also, wxSmith does not appear in the stack trace, the relation with wxSmith may be that it is the only one that uses wxPropertyGrid at all.

Looks like the call is made from wxPGDefaultRenderer::Render() inside wxPropertyGrid::OnPaint() event handler.
Pages: [1] 2 3 4 5 6 ... 10