Post new topic    
Liquid Metal Slime
Send private message
Scroll slices and Grid children 
 PostFri Aug 03, 2018 5:14 am
Send private message Reply with quote
I want to make a selection menu with slices in which options are listed with text slices on a grid. The list will eventually get pretty long, so the whole thing is wrapped in a scroll. Before I get around to coding the nitty-gritty, I'd like to know if this will work, in case anyone's done something like this before. Basically, when the player inputs "up" or "down" when the list is at its highest/lowest point within a rectangle, the list should, as a whole, scroll to where one of its children lines up with the cursor, instead of the other way around. Does that make sense?
I'm including a screenshot with a rough layout. Ignoring the text box at the top and the 3x3 grid on the right, the slice structure is as follows.

PARENT: A slice collection, loaded from a prefab in CUSTOM.
CHILD: Rectangle slice for drawing the box.
GRANDCHILD: Scroll slice, fills parent.
G.GRANDCHILD: Grid slice, has a fixed width and a varying height depending on how many list entries there are.
G.G.GRANDCHILD: Container slice, has a fixed width and height; this is what I want the cursor to use as a reference when moving from item to item. Subchildren include a text and sprite slice. Right now there's only 2 of these, but I'll test this out later with a dozen or so dummy units.

If stuff like "Scroll to child" only works one layer deep, which is what I'm worried about, then I guess I'll ditch the grid and find another solution.
Chemical Slime
Send private message
 
 PostFri Aug 03, 2018 1:50 pm
Send private message Reply with quote
I think you would use the following command


set scroll check depth (handle, depth)

Changes the number of generations of children and grandchildren that a scroll slice cares about. The first argument is the handle of the scroll slice. The second argument is the desired depth, or 0 to check the entire family tree of all child slices. For example, a depth of 1 means the scroll only considers children. 2 means it considers children+grandchildren. 3 means it considers children+grandchildren+greatgrandchildren.

http://hamsterrepublic.com/ohrrpgce/docs/plotdict.xml#about-setscrollcheckdepth
Metal King Slime
Send private message
 
 PostFri Aug 03, 2018 4:12 pm
Send private message Reply with quote
Yes, you're fine with grid and scroll slice.
You don't actually need to use "set scroll check depth" because it already defaults to 'infinite' (0). Hmm, I see that the plotdictionary doesn't explain that...

Note that the only difference between container and scroll slices is that scroll slices draw scrollbars. Maybe they should have been called scrollbar slices! Oh, and by default they're set to clip. That's not documented either...
Display posts from previous: