control在Sizer下有默认的Size? Topic is solved

这是wxWidgets论坛的中文版本。在这里,您可以用您的母语汉语讨论上面任一子论坛所涉及的所有关于wxWidgets的话题。欢迎大家参与到对有价值的帖子的中英互译工作中来!
Post Reply
HighOrder
In need of some credit
In need of some credit
Posts: 9
Joined: Tue Jun 05, 2007 8:48 am

control在Sizer下有默认的Size?

Post by HighOrder » Wed Jun 11, 2008 9:32 am

做一个3D的窗口控件,
class wxIrrWindow : public wxControl{...}
在Sizer下尺寸自动变成(100, 80),

如果我改为class wxIrrWindow : public wxWindow{...}
尺寸就没问题了,

有人能解释下吗

spritez
Earned a small fee
Earned a small fee
Posts: 21
Joined: Sat Apr 19, 2008 2:16 pm
Location: china

Post by spritez » Fri Jun 13, 2008 8:37 am

没太明白你的问题,你是说你做的窗口控件使用在别的窗口的sizer中,控件大小自动变成一个自动变成(100, 80)? 而你在制作这个控件时指定窗体大小就不会自动变化了?
*** china ***

Utensil
Moderator
Moderator
Posts: 423
Joined: Sun Feb 03, 2008 11:38 am
Location: China

Post by Utensil » Fri Jun 13, 2008 9:34 am

所谓的“尺寸就没问题了”是什么意思?

(100, 80)是太小了以至于容不下你在里面摆的东西吗?
In fascination of creating worlds by words, and in pursuit of words behind the world.

On Github: http://utensil.github.com
Technical Blog in Chinese: http://utensil.iteye.com/

HighOrder
In need of some credit
In need of some credit
Posts: 9
Joined: Tue Jun 05, 2007 8:48 am

Post by HighOrder » Sun Jun 15, 2008 3:38 am

说详细点,

就是说我做了一个irrlicht的wxWindows窗口, 刚开始继承于wxControl
class wxIrrWindow : public wxControl
{
irr::IrrlichtDevice* m_irrDevice;
...
};

//irr的初始化过程是这样的
...

irr::SIrrlichtCreationParameters param;
param.WindowId = reinterpret_cast<void*>( this->GetHandle() );
param.DriverType = drvType;
param.Vsync = true;
param.WindowSize.Width = renderSize.x;
param.WindowSize.Height = renderSize.y;

m_irrDevice = irr::createDeviceEx(param);
...

这时发觉这个控件放入Sizer里面, 任何时候大小都是(100, 80), 甚至.SetSize()也不行, 我不知道这个值是从哪里来的;

但我改成
class wxIrrWindow : public wxWindow
{
...
};
就可以设定任意的Size了,

这是一个奇怪的现象, 我不知道这和wxControl有关, 还是和irr有关, 得跟踪一下, 不过暂时不困绕我了, wxWindows满足了我的要求.

Utensil
Moderator
Moderator
Posts: 423
Joined: Sun Feb 03, 2008 11:38 am
Location: China

Post by Utensil » Sun Jun 15, 2008 4:04 am

应该是跟Irrlicht Engine有关...
In fascination of creating worlds by words, and in pursuit of words behind the world.

On Github: http://utensil.github.com
Technical Blog in Chinese: http://utensil.iteye.com/

Post Reply