Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / wxTextCtrl not displaying new values

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. wxTextCtrl not displaying new values
#4807
Posted by: grantb 2004-07-13 02:35:02
I am currently working to get a wxWidgets based application initially written (and functioning) under Windows to work under linux.

Currently on the linux side, it appears that I am unable to set a value to a wxTextCtrl other than the default value (programmatically that is).

With the below code I create my wxTextCtrl and add it to the sizer in use:
m_pMyTextCtrl = new wxTextCtrl( this, -1, "(n/a)" );
pMySizer->Add(m_pMyTextCtrl, 1, wxALL | wxALIGN_CENTER_VERTICAL | wxADJUST_MINSIZE, BORDER_SIZE );

And later retrieve a value from elsewhere and attempt to set the wxTextCtrl to use it:
wxString s;
s = wxString::Format( "%d", m_pDataStore->GetIntegerValue( 0 ) );
m_pMyTextCtrl->SetLabel( s );

I have also tried setting my own value such as: m_pMyTextCtrl->SetLabel( "T1" ) which also has no effect.

Any thoughts?

Note: This code seems to work fine under Windows.

As for versions:
Fedora Core 2
GTK: 1.2.10
wxWidgets: 2.4.2
GCC: 3.3.3
Message2. Re: wxTextCtrl not displaying new values
#4809
Posted by: grantb 2004-07-13 04:04:05
Fortunate for me I have found the cause of my problem. SetLabel is not the proper call to make to set the value of a wxTextCtrl, instead SetValue is to be used. I didn’t notice this right away as I am new wxWidget and did not write the code I am trying to get working under linux.
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2024-4-19  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0