Hi all.
Well, for my application I need a "ListItemView" structure to show a list of photos to select one of.
I create the "ListItemView" thing following RTSimpleApp code.
Then I fill it with my own data like this:
I connect each "Item" to "OnListBoxDClick" function to perform the process of simulate click and select of the "item".Code:void Fill(Entity *pParent) { Entity *pScroll = pParent->GetEntityByName("scroll"); CL_Vec2f vTextBoxPos = pScroll->GetVar("pos2d")->GetVector2(); CL_Vec2f vTextBounds = pScroll->GetVar("size2d")->GetVector2(); CL_Vec2f vRealSize = vTextBounds - vTextBoxPos; //here we add our actual content we want scrolled. At the end, we'll calculate the size used using ResizeScrollBounds and the scroll bars //can update. If you are adding content over time, (like, downloading highscores or whatever) it's ok to call ResizeScrollBounds //repeatedly to dynamically resize the scroll area as you go. pParent = pParent->GetEntityByName("scroll_child"); pParent->RemoveAllEntities(); //clear it out in case we call this more than once, say, to update/change something float x = 4; //inset float y = 4; float spacerY = 4; //space between thingies float spacerX = 4; CL_Vec2f fotosize; //define an area for a text box, so it will wrap in the right places. Height is actually ignored. // CL_Vec2f vTextBoxPos(x,y); // CL_Vec2f vTextBounds(434, 200); // string msg; //we could load text, but let's just manually put junk in there: string sPhotoName; string sPhoto; int c = 0; while(c < 10){ sPhotoName ="Photo" + char(c+48); sPhoto = (string)"Lib/Photos/" + sPhotoName + (string)".jpg"; Entity* ppito = CreateOverlayButtonEntity(pParent,sPhotoName,sPhoto,x,y); ppito->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&OnListBoxDClick); fotosize = ppito->GetVar("size2d")->GetVector2(); x += fotosize.x; x += spacerX; if((x + fotosize.x) > vRealSize.x){ x = 4; y += fotosize.y + spacerY; } c++; } //actually create the text box with the above text //do something if someone clicks it //automatically calculate the total size of this entity with all its children for the scroll bars, do this at the end VariantList vList(pScroll); ResizeScrollBounds(&vList); }
Well, all this works fine until I updated the SDK from svn to 774 version.
Since then, no "Item" can be clicked, that is, the "OnListBoxDClick" function does not calling anymore.
What am I doing wrong?
Is there a better way of doing it?
Regards.
Bookmarks