View Single Post
  #6  
Unread 02-11-2011, 11:59 PM
Zonx's Avatar
Zonx Zonx is offline
A Green Troll
This person is a EQ2Map developer.
Featured
 
Join Date: Dec 2004
Server: Blackburrow
Posts: 2,221
Default

The ScrollLocation property controls the x,y offset of the viewable area.

To do what I think you're after (scroll the last visible icon into view) I'd do the following...

Note: Pseudo code... and you'll probably have to fiddle with the math to get the desired results, but this should give you a place to start. This assumes your volume page always flows left to right, top to bottom. If instead you are using the edge detection variable flow feature used in the default Maintained window, you'll need to add code to determine the flow and adjust accordingly.

Give each icon page an OnShow script that does the following...

Cols = window.width / iconPage.width
Cols = int(Cols + 0.5)
Rows = window.height / iconPage.height
Rows = int(Rows + 0.5)
LastRow = ceil(iconNumber / Cols)
RowDiff = LastRow - Rows
yOffset = RowDiff * iconPage.height
window.ScrollLocation = "0," ## yOffset

Also give each iconPage an OnHide script that does almost the same thing but subtracts the hidden icon...

LastIconNum = iconNumber -1
Cols = window.width / iconPage.width
Cols = int(Cols + 0.5)
Rows = window.height / iconPage.height
Rows = int(Rows + 0.5)
LastRow = ceil(LastIconNum / Cols)
RowDiff = LastRow - Rows
yOffset = RowDiff * iconPage.height
window.ScrollLocation = "0," ## yOffset

So in short you have scripts on all icons that adjust the scroll location to bring an icon into view if it was previously hidden. Likewise you have scripts on all icons to adjust the scroll location when a previously visible icon is hidden, to remove the now empty space by scrolling the prior visible icon into view.
Reply With Quote