View Single Post
  #16  
Unread 02-13-2011, 10:49 AM
Draven_Caine's Avatar
Draven_Caine Draven_Caine is offline
A Griffon
Interface Author - Click to view interfaces
 
Join Date: Oct 2009
Server: Unrest
Posts: 155
Default

Quote:
Originally Posted by Zonx View Post
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.
I am working off the default maintained window code, I had a question to what is meant by the IconPage.
The hierarchy is as follows:

Maintained (page)
- Volume (VolumePage)
-- Frame1 (Page)
--- CancelEffectButton (Button)
--- Icon (Image)
--- Target (text)
--- Subtitle (Text)
--- Name (Text)
-- Frame2
--- CancelEffectButton (Button)
--- Icon (Image)
--- Target (text)
--- Subtitle (Text)
--- Name (Text)
-- Frame3
--- CancelEffectButton (Button)
--- Icon (Image)
--- Target (text)
--- Subtitle (Text)
--- Name (Text)
- WindowFrame
-- Frame
-- Background

I add the element names next to the elements.

Now i had a thought, might be way off, but say the maintained window is 100 px tall and the volume page is 200px tall cant we tell the volume page to have a top location of -100?

Your code might do that just a amateur UI coder's thoughts lol

Thanks,
Draven

Last edited by Draven_Caine : 02-13-2011 at 01:44 PM.
Reply With Quote