Game Development Community

Trivial bugfix to GuiMessageVectorCtrl - remove child-of-GuiScrollCtrl requirement

by Orion Elenzil · 04/11/2006 (2:02 pm) · 3 comments

GuiMessageVectorCtrl.cc

1.
at the top of GuiMessageVectorCtrl::lineInserted(),
change this:
GuiScrollCtrl* pScroll = dynamic_cast<GuiScrollCtrl*>(getParent());
   bool fullyScrolled = pScroll->isScrolledToBottom();

to this:

bool fullyScrolled = false;
   GuiScrollCtrl* pScroll = dynamic_cast<GuiScrollCtrl*>(getParent());
   if (pScroll != NULL)
       fullyScrolled = pScroll->isScrolledToBottom();


2. at the bottom of the same method,
change this:
pScroll->scrollTo(0, 0x7FFFFFFF);

to this:

if(pScroll != NULL && fullyScrolled)
      pScroll->scrollTo(0, 0x7FFFFFFF);


.. shame on whomever wrote that code originally, btw! ;)

#1
04/29/2006 (1:41 am)
Excellent... Bugs deserve to be killed. Even if they are trivial...heheh.

BTW: Is this an issue with 1.4 and/or TSE? (Edit again: Well, the fixes aren't in TSE yet, anyway)

Edit again, again: Sorry...beer and C++ may not be the best combination of vices I could have developed.
#2
04/29/2006 (1:56 am)
lol ! word !

i'd be surprised if this were fixed in either TGE 1.4 or TSE.

i just noticed yesterday that Ed Maurina's book The Game Programmer's Guide to Torque even includes the caveat that GuiMessageVectorCtrl's must be children of GuiScrollCtrl's.

- i mean, you probably *do* want the message vector to be a child of a scroll ctrl, but it's shouldn't crash if you don't set it up that way.
#3
08/21/2006 (5:42 pm)
This hasn't been changed as of TGB 1.1.