wxTextCtrl and wxHSCROLL

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
nkwinder
Experienced Solver
Experienced Solver
Posts: 70
Joined: Sun Nov 23, 2008 2:32 pm

wxTextCtrl and wxHSCROLL

Post by nkwinder » Mon Mar 02, 2009 6:13 pm

hello

i just created this control...

Code: Select all

wxTextCtrl *chane = new wxTextCtrl(this, wxID_ANY, wxT("123.......123"), wxPoint(10,10), wxSize(220,45), wxTE_READONLY | wxHSCROLL);
The text is very long, but there is no point pasting it here.

The thing is that, although the scrollbar is shown, when i try to scroll, it always remains to the start point. The scrollbar handle doesn't move, and scroll doesn't change. What am i doing wrong?

thanks in advance!

chris_bern
Earned some good credits
Earned some good credits
Posts: 125
Joined: Wed Mar 05, 2008 3:30 pm

Post by chris_bern » Mon Mar 02, 2009 10:25 pm

Code: Select all

class MyPanel : public wxPanel 
{
	private:
	
	protected:
		wxTreeCtrl* MyTreeCtrl;
	
	public:
		MyPanel( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL );
		~MyPanel();
	
};

Code: Select all

MyPanel::MyPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
{
	wxBoxSizer* MyPanelSizer;
	MyPanelSizer = new wxBoxSizer( wxVERTICAL );
	
	MyTreeCtrl = new wxTreeCtrl( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), 0 );
	MyPanelSizer->Add( MyTreeCtrl, 0, wxALL|wxEXPAND, 0 );
	
	this->SetSizer( MyPanelSizer );
	this->Layout();
}

MyPanel::~MyPanel()
{
}
Try the code above, if it works then integrate it with your code.

Chris

Post Reply