Tab page control off (only in release) - RESOLVED
by Nathan Bowhay - ESAL · in Torque 3D Professional · 12/18/2010 (12:04 am) · 11 replies
I have a tabbed page control that is set to fitBook = 1 and position = 0 0. When I start the build in debug it looks fine, but in release it is shifted down 40 (position of "0 40"). This only happens in release and after setting a breakpoint in script it happen right after the gui file is executed.
Anyone have any ideas? Where to look. Only thing I can think of is some value isn't set in the constructor, but there doesn't seem to be any that aren't set.
Anyone have any ideas? Where to look. Only thing I can think of is some value isn't set in the constructor, but there doesn't seem to be any that aren't set.
#2
Ah, BTW, forgot: of course, you have to enable debugging support in the release build for this to work.
12/18/2010 (1:21 am)
Ah, BTW, forgot: of course, you have to enable debugging support in the release build for this to work.
#3
mPageRect.point has expression cannot be evaluated so I am guessing it is being optimized out of the class or something?
When I the code reaches fitPage it skips over the function call and goes straight to GuiContainer::resize passing it 0, 40 for position which is where the position is getting change to I guess. It seems like a ton of code is vastly changing, because of what I am guessing is optimizations. I ran into another bug where odd things where happening to a value returned from a console method because of the same thing. The way I was able to fix it is to make the code more efficient (return a const reference rather than a copy.
Is anyone else experiencing issues like this? It is really worrisome.
Note: I am using VS2010 because of the requirement of the latest direct x version.
12/21/2010 (11:31 pm)
Interesting I followed: msdn.microsoft.com/en-us/library/fsk896zz%28v=VS.100%29.aspx. So now I am debugging the code and there looks to be some major optimization changes or something.mPageRect.point has expression cannot be evaluated so I am guessing it is being optimized out of the class or something?
When I the code reaches fitPage it skips over the function call and goes straight to GuiContainer::resize passing it 0, 40 for position which is where the position is getting change to I guess. It seems like a ton of code is vastly changing, because of what I am guessing is optimizations. I ran into another bug where odd things where happening to a value returned from a console method because of the same thing. The way I was able to fix it is to make the code more efficient (return a const reference rather than a copy.
Is anyone else experiencing issues like this? It is really worrisome.
Note: I am using VS2010 because of the requirement of the latest direct x version.
#4
I am using VS2008 Xpress; and DXSDK_Jun10(2010) On an XP system.
12/22/2010 (2:41 am)
Hey Nathan. I have yet to start real work on my GUI's, but if you wish to drop a chunk of code who exhibit this problem, I would be happy to collaborate.I am using VS2008 Xpress; and DXSDK_Jun10(2010) On an XP system.
#5
add
Then go to void GuiTabBookCtrl::calculatePageTabs() and change:
And these are the results I get:
Debug:
Settings Rows: 0 TabHeight: 20
TabRect Rows: 1 TabHeight: 20
Page Settings Height: 20 Resize Value: 0 20
Settings Rows: 0 TabHeight: 20
Table Rows: 0 TabHeight: 20
TabRect Rows: 1 TabHeight: 20
Page Table Height: 20 Resize Value: 0 20
ReleaseDebugEnabled:
Settings Rows: 1 TabHeight: 20
TabRect Rows: 2 TabHeight: 20
Page Settings Height: 20 Resize Value: 0 40
Settings Rows: 1 TabHeight: 20
Table Rows: 2 TabHeight: 20
TabRect Rows: 3 TabHeight: 20
Page Table Height: 20 Resize Value: 0 60
If you notice the row count ends up being 2 and since the y is row * TabHeight that gives it the 40 I was getting. I am going to figure out exactly what is being changed in the optimizations, but you can see where the bug is at this point and what is going on.
12/22/2010 (3:13 am)
Ok so it turns out it has to do with the row count here is what I did (this is all in guiTabBookCtrl.cpp):add
Con::printf("Page %s Height: %i Resize Value: %i %i", page->getText(), mTabHeight, mPageRect.point.x, mPageRect.point.y);aftercalculatePageTabs();in
void GuiTabBookCtrl::onChildAdded( GuiControl *child )
Then go to void GuiTabBookCtrl::calculatePageTabs() and change:
// Adjust Y Point based on alignment
if( mTabPosition == AlignTop )
info.TabRect.point.y = ( info.TabRow * mTabHeight );
else
info.TabRect.point.y = getHeight() - ( ( 1 + info.TabRow ) * mTabHeight );toif( mTabPosition == AlignTop )
{
Con::printf("%s Rows: %i TabHeight: %i", info.Page->getText(), info.TabRow, mTabHeight);
info.TabRect.point.y = ( info.TabRow * mTabHeight );
}
else
{
Con::printf("%s Rows: %i TabHeight: %i: Height: %i", info.Page->getText(), info.TabRow, mTabHeight, getHeight());
info.TabRect.point.y = getHeight() - ( ( 1 + info.TabRow ) * mTabHeight );
}and in the same method add:Con::printf("TabRect Rows: %i TabHeight: %i", currRow, mTabHeight);afterlocalPoint.y -= getTop();
And these are the results I get:
Debug:
Settings Rows: 0 TabHeight: 20
TabRect Rows: 1 TabHeight: 20
Page Settings Height: 20 Resize Value: 0 20
Settings Rows: 0 TabHeight: 20
Table Rows: 0 TabHeight: 20
TabRect Rows: 1 TabHeight: 20
Page Table Height: 20 Resize Value: 0 20
ReleaseDebugEnabled:
Settings Rows: 1 TabHeight: 20
TabRect Rows: 2 TabHeight: 20
Page Settings Height: 20 Resize Value: 0 40
Settings Rows: 1 TabHeight: 20
Table Rows: 2 TabHeight: 20
TabRect Rows: 3 TabHeight: 20
Page Table Height: 20 Resize Value: 0 60
If you notice the row count ends up being 2 and since the y is row * TabHeight that gives it the 40 I was getting. I am going to figure out exactly what is being changed in the optimizations, but you can see where the bug is at this point and what is going on.
#6
And that is in a window of course.
12/22/2010 (3:14 am)
Oh and I haven't tested this in a stock build, but this code looks to be the same as beta 3 so it should happen. I have a tab book and pages that like this:new GuiTabBookCtrl() {
tabPosition = "Top";
tabMargin = "7";
minTabWidth = "64";
tabHeight = "20";
allowReorder = "0";
defaultPage = "0";
selectedPage = "0";
frontTabPadding = "0";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "12 30";
extent = "533 178";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "height";
profile = "GuiTabBookProfile";
visible = "1";
active = "1";
Clickable = "1";
AffectChildren = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiTabPageCtrl() {
fitBook = "1";
text = "Settings";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "0 0";
extent = "533 158";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "height";
profile = "GuiTabPageProfile";
visible = "1";
active = "1";
Clickable = "1";
AffectChildren = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiControl() {
position = "0 0";
extent = "534 159";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "height";
profile = "SkinnedGuiCtrlProfile";
visible = "1";
active = "1";
Clickable = "1";
AffectChildren = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
};
new GuiTabPageCtrl() {
fitBook = "1";
text = "Table";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "0 0";
extent = "533 158";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "height";
profile = "GuiTabPageProfile";
visible = "0";
active = "1";
Clickable = "1";
AffectChildren = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
hidden = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiControl() {
position = "0 0";
extent = "534 159";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "height";
profile = "SkinnedGuiCtrlProfile";
visible = "1";
active = "1";
Clickable = "1";
AffectChildren = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
};
};And that is in a window of course.
#7
mTabWidth is not set anyplace from what I can see. I am going to just set it to 0 in the ctor, but is it suppose to be set to something someplace else?
12/22/2010 (7:13 pm)
Ok figured it out; turns out it isn't an issue with the compiler optimizing code, the other issue I had was for sure, but this apears to be an issue with a variable never being initilaized.mTabWidth is not set anyplace from what I can see. I am going to just set it to 0 in the ctor, but is it suppose to be set to something someplace else?
#8
always seems to pass even if I set a font so it never uses:
12/22/2010 (7:42 pm)
The other thing I noticed at least in release is that the check:if( !text || dStrlen(text) == 0 || mProfile->mFont == NULL )
always seems to pass even if I set a font so it never uses:
font->getStrNWidth( text, dStrlen(text) );
#9
01/07/2011 (11:05 pm)
Logged as THREED-1301.
#10
I just put in a fix for the next release of T3D. After looking into it, and based on your advice Nathan, I felt that mTabWidth should have been replaced with mMinTabWidth in the calculatePageTabWidth() checks. I then removed mTabWidth completely.
As you noticed, mTabWidth was never set, and may never be set by the user. It makes more sense to return mMinTabWidth when a page is not defined or there is no font, especially as that may be defined by the user in script.
As for your other issue with not reaching the font->getStrNWidth() code, are you sure that isn't occurring at some point in the tab book's lifetime? I found that calculatePageTabWidth() ends up being called a few times for each book as the system gets itself set up, and it did eventually reach that font code.
Thanks!
- Dave
01/31/2011 (2:35 pm)
Greetings!I just put in a fix for the next release of T3D. After looking into it, and based on your advice Nathan, I felt that mTabWidth should have been replaced with mMinTabWidth in the calculatePageTabWidth() checks. I then removed mTabWidth completely.
As you noticed, mTabWidth was never set, and may never be set by the user. It makes more sense to return mMinTabWidth when a page is not defined or there is no font, especially as that may be defined by the user in script.
As for your other issue with not reaching the font->getStrNWidth() code, are you sure that isn't occurring at some point in the tab book's lifetime? I found that calculatePageTabWidth() ends up being called a few times for each book as the system gets itself set up, and it did eventually reach that font code.
Thanks!
- Dave
#11
04/22/2011 (2:59 pm)
Fixed in 1.1 Final and Preview.
Associate Rene Damm
Don't have anything out of the top of my head but easiest thing to track this stuff down usually is to set a breakpoint in the constructor and then set a data breakpoint on &mBounds.point.y on the control in question. When the breakpoint hits, you know who's messing with the value.