Logo Search packages:      
Sourcecode: codeblocks version File versions  Download package

wxWindow * wxPropertyGrid::GenerateEditorTextCtrl ( const wxPoint &  pos,
const wxSize &  sz,
const wxString &  value,
wxWindow *  secondary,
int  extraStyle = 0,
int  maxLen = 0 

Shortcut for creating text editor widget.

posSame as pos given for CreateEditor.
szSame as sz given for CreateEditor.
valueInitial text for wxTextCtrl.
secondaryIf right-side control, such as button, also created, then create it first and pass it as this parameter.
extraStyleExtra style flags to pass for wxTextCtrl.
Note that this should generally be called only by new classes derived from wxPGProperty.

Definition at line 4878 of file propgrid.cpp.

References FixPosForTextCtrl(), and wxPG_PROP_READONLY.

    int tcFlags = wxTE_PROCESS_ENTER | extraStyle;

      if ( m_selected->HasFlag(wxPG_PROP_READONLY) )
            tcFlags |= wxTE_READONLY;

    wxPoint p(pos.x,pos.y);
    wxSize s(sz.x,sz.y);

   // Need to reduce width of text control on Mac
#if defined(__WXMAC__)
   s.x -= 8;

     // Take button into acccount
    if ( secondary )
        s.x -= (secondary->GetSize().x + wxPG_TEXTCTRL_AND_BUTTON_SPACING);
        m_iFlags &= ~(wxPG_FL_PRIMARY_FILLS_ENTIRE);

    // If the height is significantly higher, then use border, and fill the rect exactly.
    bool hasSpecialSize = false;

    if ( (sz.y - m_lineHeight) > 5 )
        hasSpecialSize = true;


    // Create clipper window
    wxPGClipperWindow* wnd = new wxPGClipperWindow();
#if defined(__WXMSW__)

    // This generates rect of the control inside the clipper window
    if ( !hasSpecialSize )
        wnd->GetControlRect(wxPG_NAT_TEXTCTRL_BORDER_X, wxPG_NAT_TEXTCTRL_BORDER_Y, p, s);
        wnd->GetControlRect(0, 0, p, s);

    wxWindow* ctrlParent = wnd;


    wxWindow* ctrlParent = this;

    if ( !hasSpecialSize )
        tcFlags |= wxNO_BORDER;


    wxTextCtrl* tc = new wxTextCtrl();

#if defined(__WXMSW__) && !wxPG_NAT_TEXTCTRL_BORDER_ANY
    tc->Create(ctrlParent,wxPG_SUBID1,value, p, s,tcFlags);

    wxWindow* ed = wnd;
    wxWindow* ed = tc;

    // Center the control vertically
    if ( !hasSpecialSize )

#ifdef __WXMSW__
    if ( secondary )

    // Set maximum length
    if ( maxLen > 0 )
        tc->SetMaxLength( maxLen );

    return (wxWindow*) ed;

Here is the call graph for this function:

Generated by  Doxygen 1.6.0   Back to index