About Store Forum Documentation Contact



Post Reply 
Strange behavior with interactive elements
Author Message
MrPi Offline
Member

Post: #1
Strange behavior with interactive elements
I have a window with around 24 objects inherited from CheckBox. They are rendering parts from an ImageAtlas.
Now I added one more button to the window and half of these CheckBoxes are now invisible. They are still there, I can still click on them, but they are not displayed. I was wondering whether I hit a cap of GUI elements. For a test, I replaced the button with a Text element. No problem there, all elements were displayed.

In a second test I used a TextLine instead of the button and noticed something weird. When the TextLine had focus (showed the text cursor), all elements were visible. When I clicked outside the TextLine (and the focus was gone again), the checkboxes turned invisible again.

I have no idea what else to try. It's always the same checkboxes that turn invisible. But they were all added to the same window (no regions or anything).

Would could be the problem here? Any hint would be appreciated.
11-26-2013 08:36 PM
Find all posts by this user Quote this message in a reply
cmontiel Offline
Member

Post: #2
RE: Strange behavior with interactive elements
Are you using D.clip(gpc.clip); before draw?
11-26-2013 11:11 PM
Find all posts by this user Quote this message in a reply
MrPi Offline
Member

Post: #3
RE: Strange behavior with interactive elements
I have verified, that the draw() function is called of the invisible elements. I also verified, that a GuiImage in the background is drawn before them and not after.

cmontiel, I put what you suggested into the draw() function for these elements and it worked. Thank you very much! Could you explain to me what exactly that does? I mean I read the engine comment, but what did that change?

In a tutorial I read this:
"// clip display drawing to given clipping rectangle, this is needed for example when object is inside a window, and is partially hidden because the parent's rectangle doesn't fully cover this object"

The object is in a window indeed, but the parent rectangle should always fully cover the object, actually. So I'm wondering why adding one more object to the same window would require this call all of a sudden.
(This post was last modified: 11-26-2013 11:37 PM by MrPi.)
11-26-2013 11:18 PM
Find all posts by this user Quote this message in a reply
cmontiel Offline
Member

Post: #4
RE: Strange behavior with interactive elements
It prepares the rectangle where you can draw. You can call D.clip with any rect parameter. If you draw outside that rect, will not be displayed.

If you don't call D.clip , it can have a different rect of other gui elements or NULL.

static void clip (C Rect *rect=NULL);// set rectangle clipping, NULL for none
static void clip (C Rect &rect ) {clip(&rect);} // set rectangle clipping
(This post was last modified: 11-27-2013 12:39 AM by cmontiel.)
11-27-2013 12:31 AM
Find all posts by this user Quote this message in a reply
MrPi Offline
Member

Post: #5
RE: Strange behavior with interactive elements
Alright. Thank you for clearing that up!
11-27-2013 01:34 PM
Find all posts by this user Quote this message in a reply
Post Reply