ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   scroll page inside window (https://www.esoui.com/forums/showthread.php?t=1653)

hulksmash 05/27/14 04:53 PM

scroll page inside window
 
How can I make a window box with a bunch of contents inside it that the user can scroll through using the mousewheel? For example, I have a window with several rows, lets just use labels for now. I want them inside the box but when you mouse over the window and use the scroll wheel it moves the page inside up and down. This would be similar to the player's inventory window. I do not want the contents to go outside the boundry of the window when you scroll up and down

Code:

               
                ss =  swaps.Chain( wm:CreateTopLevelWindow("ss") )
                        :SetDimensions(200,600)
                        :SetAnchor(CENTER)
                .__END

                ss.bg = swaps.Chain( wm:CreateControl("ss.bg", ss, CT_BACKDROP))
                        :SetEdgeColor(.3,.3,.3,.5)
                          :SetCenterColor(.1,.1,.1,.99)
                          :SetAnchor(TOPLEFT, ss, TOPLEFT, 0, 0)
                          :SetDimensions(100,200)
                          :SetDrawLayer(10)
                  .__END


                  ss.row1 = swaps.Chain( wm:CreateControl("ss.row1", ss, CT_LABEL) )
                          :SetText("Some info")
                          :SetFont("ZoFontAlert")
                          :SetColor(0.8, 0.8, 0.8, 1)
                          :SetScale(1)
                          :SetAnchor(TOPLEFT, ss, TOPLEFT, 0, 0)

                          :SetDrawLayer(5)
                  .__END

                  ss.row2 = swaps.Chain( wm:CreateControl("ss.row2", ss, CT_LABEL) )
                          :SetText("Some info 2")
                          :SetFont("ZoFontAlert")
                          :SetColor(0.8, 0.8, 0.8, 1)
                          :SetScale(1)
                          :SetAnchor(TOPLEFT, ss, TOPLEFT, 0, 20)
                          :SetDrawLayer(5)
                  .__END


Seerah 05/27/14 05:15 PM

You would create a Scroll frame and then use that as the parent of your other controls.

Garkin 05/27/14 05:45 PM

Quote:

Originally Posted by Seerah (Post 8644)
You would create a Scroll frame and then use that as the parent of your other controls.

Something like:
Lua Code:
  1. container = WINDOW_MANAGER:CreateControlFromVirtual("name", tlw, "ZO_ScrollContainer")
  2. --set some anchors, create backdrop etc.
  3.  
  4. scroll = container:GetNamedChild("ScrollChild")
  5. --scroll will be parent for your controls

hulksmash 05/27/14 07:47 PM

Quote:

Originally Posted by Garkin (Post 8646)
Something like:
Lua Code:
  1. container = WINDOW_MANAGER:CreateControlFromVirtual("name", tlw, "ZO_ScrollContainer")
  2. --set some anchors, create backdrop etc.
  3.  
  4. scroll = container:GetNamedChild("ScrollChild")
  5. --scroll will be parent for your controls

After about 100 reloaduis I think I finally got it. Main problem was my rows were anchored to the container and not the scroll. /Facepalm


All times are GMT -6. The time now is 05:04 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI