| Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next 1 | 1. Enable/Disable wxTextCtrl #4918 Posted by: 2004-07-31 19:18:41 | Hi guys!
I want a editable small textfield, that can be disabled while processing other things. So I first tried SetEditable(), but it won't work. The Editable Value turns correctly to false, but I can edit it!!!!
Then I searched a while and found the Enable() function, but this won't work, too!
What else can I try? | 2. Re: Enable/Disable wxTextCtrl #4919 Posted by: 2004-08-01 02:17:22 | Enable() works :)
but you have to Disable() the object first to see something cause every object is enabled by default
| 3. Re: Enable/Disable wxTextCtrl #4920 Posted by: 2004-08-01 16:46:14 | Sorry, but this won't work either!
The Textbox still can be edited.
I tried several methods:
textbox1.SetEditable(false); textbox1.Disable(); textbox1.Enable(false);
But none of them change anything to the Textbox!
| 4. Re: Enable/Disable wxTextCtrl #4922 Posted by: KaReL 2004-08-01 18:02:31 | wxTextCtrl ( http://wxwidgets.org/manuals/2.5.2/wx_wxtextctrl.html#wxtextctrl )
Create it with the flag: wxTE_READONLY The text will not be user-editable.------------------------ Website: www.KaReLs0ft.be | 5. Re: Enable/Disable wxTextCtrl #4923 Posted by: 2004-08-01 18:32:42 | But what can I do, if I want change this flag on runtime?
In the manual the possible function is SetEditable(). The flag will change with SetEditable(true / false), but the textbox still remains editable | 6. Re: Enable/Disable wxTextCtrl #4937 Posted by: bec 2004-08-04 12:51:27 | Hi there.. I created a sample which works. Might help you. Good luck ;) Cheers bec.
-----------------------------------------------------------------------
// for compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h"
#ifdef __BORLANDC__ #pragma hdrstop #endif
// for all others, include the necessary headers #ifndef WX_PRECOMP #include "wx/app.h" #include "wx/log.h" #include "wx/frame.h" #include "wx/button.h" #include "wx/checkbox.h" #include "wx/listbox.h" #include "wx/statbox.h" #include "wx/stattext.h" #include "wx/textctrl.h" #endif
#include "wx/sizer.h" #include "wx/arrimpl.cpp"
// ---------------------------------------------------------------------------- // our classes // ----------------------------------------------------------------------------
WX_DECLARE_OBJARRAY(wxBitmap, wxArrayBitmap); WX_DEFINE_OBJARRAY( wxArrayBitmap );
// Define a new application type, each program should derive a class from wxApp class WidgetsApp : public wxApp { public: // override base class virtuals // ----------------------------
// this one is called on application startup and is a good place for the app // initialization (doing it here and not in the ctor allows to have an error // return: if OnInit() returns false, the application terminates) virtual bool OnInit(); };
// Define a new frame type: this is going to be our main frame class WidgetsFrame : public wxFrame { public: // ctor(s) and dtor WidgetsFrame(void); WidgetsFrame(const wxString& title); ~WidgetsFrame(){};
wxTextCtrl *m_log; };
// ---------------------------------------------------------------------------- // misc macros // ---------------------------------------------------------------------------- IMPLEMENT_APP(WidgetsApp)
// ============================================================================ // implementation // ============================================================================
// ---------------------------------------------------------------------------- // app class // ----------------------------------------------------------------------------
bool WidgetsApp::OnInit() { if ( !wxApp::OnInit() ) return FALSE;
wxFrame *frame = new WidgetsFrame(_T(" widgets demo")); frame->Show();
return TRUE; }
// ---------------------------------------------------------------------------- // WidgetsFrame construction // ----------------------------------------------------------------------------
WidgetsFrame::WidgetsFrame(const wxString& title) : wxFrame(NULL, -1, title, wxPoint(0, 50), wxSize(400, 400)) {
m_log = new wxTextCtrl( this, -1, _T("This is the log window.\n"), wxPoint(5,260), wxSize(630,100), wxTE_MULTILINE /* | wxTE_RICH */);
m_log->SetEditable(false);
}
| Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next 1 |
|
|