Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / Single wxTextCtrl automatically occupies entire frame area

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

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Single wxTextCtrl automatically occupies entire frame area
#2438
Posted by: 2003-08-05 15:26:15
Hi,
Just need to clarify this matter. I create an instance of a wxTextCtrl in my frame as follows:

textframe::textframe(const wxChar* title, int xpos, int ypos, int width, int height)
:wxFrame((wxFrame*) NULL, -1, title, wxPoint(xpos,ypos), wxSize(width, height))
{
   m_pTextCtrl_Test = new wxTextCtrl (this, -1, wxString("Lets have string..."),wxPoint (0,0), wxSize(80,80), wxTE_MULTILINE);

}

However instead of occupying the area specified the TextCtrl automatically occupied the entire frame area which i specified as a 800x600 window. Is this intentional?

I tried using 2 TextCtrls and only then will the TextCtrls occupy the area's i specified.
Message2. Re: Single wxTextCtrl automatically occupies entire frame area
#2452
Posted by: 2003-08-10 05:06:18
Hi,

You need to place the text control inside either a panel or a sizer.
Message3. Re: Single wxTextCtrl automatically occupies entire frame area
#2453
Posted by: 2003-08-11 10:45:36
Hi, I have a question about the wxTextCtrl also.  I'm using MSVC 6.  I cannot get the program to compile.  I copied it from the tutorial pdf (wxwindows 2.4.1), but I get two errors:
//
c:wxwinsamplestexteditortextframe.cpp(11) : error C2511: 'TextFrame::TextFrame' : overloaded member function 'void (const char *,int,int,int,int)' not found in 'TextFrame'
        c:wxwinsamplestexteditortextframe.h(4) : see declaration of 'TextFrame'

c:wxwinsamplestexteditortextframe.cpp(56) : fatal error C1004: unexpected end of file found
//
Well, of course an unexpected end of file found is never good and usually easily solved, but I can't see why it goes wrong.  The first error points to:
//
TextFrame::TextFrame(const wxChar* title, int xpos, int ypos, int width, int height)
: wxFrame((wxFrame*) NULL, -1, title, wxPoint(xpos,ypos), wxSize(width, height))
{
//

Now, I'm no C++ master, but I'm not a total idiot either.  I know that the : character is used for inheritance in classes, but here it's used to call the wxFrame class?  Why is it going wrong?  If someone could also copy the TextEditor header and cpp from the tutorial pdf (pages 18 and 19), and see if they get these same errors, and then tell how to fix them, I would greatly appreciate it.  Thank you.

Message4. Re: Single wxTextCtrl automatically occupies entire frame area
#2463
Posted by: 2003-08-12 12:44:05
nevermind: solved it thanks to wxWiki.
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2024-3-28  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0