Bah! List-box scrolling (Solved)

Started by Dualnames, Sun 18/04/2010 22:45:56

Previous topic - Next topic

Dualnames

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.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Ali

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?

monkey0506

#2
Code: ags
// repeatedly_execute
btnScrollUp.Visible = (lstItems.TopItem != 0);
btnScrollDown.Visible = ((lstItems.TopItem + lstItems.RowCount) < lstItems.ItemCount);

Dualnames

Quote from: monkey_05_06 on Mon 19/04/2010 04:03:52
Code: ags
// 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!
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

monkey0506

Sure thing Dual. :)

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

Dualnames

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!
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

SMF spam blocked by CleanTalk