View Single Post
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