About Store Forum Documentation Contact



Post Reply 
GuiObj::child(i) always return NULL
Author Message
Roman Offline
Member

Post: #1
GuiObj::child(i) always return NULL
Hi, again!

I have noticed this in my code. I moved code in sample "07 - Game Menu". The result is same.

Code:
void create()
   {
      Gui   +=window   .create(Rect_C(0,-0.1,0.6,0.6)).barVisible(false);
      window+=b_new    .create(Rect_C(window.crect.w()/2,-0.15,0.4,0.08),"New"    ,New);
      window+=b_load   .create(Rect_C(window.crect.w()/2,-0.25,0.4,0.08),"Load"   ,Load);
      window+=b_options.create(Rect_C(window.crect.w()/2,-0.35,0.4,0.08),"Options",Options);
      window+=b_exit   .create(Rect_C(window.crect.w()/2,-0.45,0.4,0.08),"Exit"   ,Exit);
      window.flag&=~WIN_MOVABLE; // disable moving of this window
      window.level(-1)         ; // set lower level so this window will be always below the other created in this tutorial


      int child_count = window.childNum();
      for (int i = 0; i < child_count; i++)
      {
          GuiObj* obj = window.GuiObj::child(i);
          int a = 1; // Here obj is equal NULL
      }
   }
10-13-2009 07:28 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
Re: GuiObj::child(i) always return NULL
sorry, you're right! I just looked into GuiObj::child and I laughed because of the stupid error I made

if(InRange(i,*children))
children->children[i]; /////// here no return smile
return NULL;

I'll fix this in the next release, thanks!
10-13-2009 12:49 PM
Find all posts by this user Quote this message in a reply
Post Reply