Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Dualnames on Sun 18/04/2010 22:45:56

Title: Bah! List-box scrolling (Solved)
Post by: Dualnames on Sun 18/04/2010 22:45:56
I have this list in a GUI. Good for me really. Now I have two buttons (one that scrolls up the list and one that scrolls down).
I did a search, but I couldn't find what I wanted. What I want is ten bucks on my PAYPAL account, and someone to tell me how to turn off and on the buttons only when necessary. I don't want them to be constantly on.

The list can contain about 10 items. When items 1-10 are visible scroll down should be available. When items 2-11 are visible scroll up should be available and scroll down too (if number of items >11). if items are less than 11 there's no point scrolling the list is there.

This is just an example.
Title: Re: Bah! List-box scrolling
Post by: Ali on Sun 18/04/2010 23:25:23
Use ListBox.TopItem to check the position.  For instance, if the value is 0 make the up-arrow invisible, otherwise make it visible. Is that what you're looking for?
Title: Re: Bah! List-box scrolling
Post by: monkey0506 on Mon 19/04/2010 04:03:52
// repeatedly_execute
btnScrollUp.Visible = (lstItems.TopItem != 0);
btnScrollDown.Visible = ((lstItems.TopItem + lstItems.RowCount) < lstItems.ItemCount);
Title: Re: Bah! List-box scrolling
Post by: Dualnames on Mon 19/04/2010 19:12:48
Quote from: monkey_05_06 on Mon 19/04/2010 04:03:52
// repeatedly_execute
btnScrollUp.Visible = (lstItems.TopItem != 0);
btnScrollDown.Visible = ((lstItems.TopItem + lstItems.RowCount) < lstItems.ItemCount);


Well, I never thought this was possible. Thanks a lot Monkey!
Title: Re: Bah! List-box scrolling (Solved)
Post by: monkey0506 on Tue 20/04/2010 00:17:50
Sure thing Dual. :)

Haven't you learned to be careful about thinking things are impossible in AGS yet?? :P
Title: Re: Bah! List-box scrolling (Solved)
Post by: Dualnames on Tue 20/04/2010 11:37:22
Quote from: monkey_05_06 on Tue 20/04/2010 00:17:50
Sure thing Dual. :)

Haven't you learned to be careful about thinking things are impossible in AGS yet?? :P

..you teaser you!...

But nevertheless a really nice trick. Instead of using if statements, this could really come in totally handy!