Thread Tools Display Modes
05/27/14, 04:53 PM   #1
hulksmash
 
hulksmash's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 30
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
  Reply With Quote
05/27/14, 05:15 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
You would create a Scroll frame and then use that as the parent of your other controls.
  Reply With Quote
05/27/14, 05:45 PM   #3
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by Seerah View Post
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
  Reply With Quote
05/27/14, 07:47 PM   #4
hulksmash
 
hulksmash's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 30
Originally Posted by Garkin View Post
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
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » scroll page inside window


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off