Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: RickJ on Thu 23/03/2006 05:20:50

Title: Suggestion: Listbox background color
Post by: RickJ on Thu 23/03/2006 05:20:50
There are a number of listbox suggestions on the tracker so here are a couple more.

Title: Re: Suggestion: Listbox background color
Post by: Ashen on Thu 23/03/2006 10:18:22
Couldn't that be reduced to:

WinBluListbox.Height = (WinBluListbox.ItemCount * 5);

(Or gListbox.ItemCount, which you used. Although surely that'd be an infinite loop?)

But I like the background colour for ListBoxes suggestion. While we're at it, could it also include TextBoxes and Labels (and possibly Inventory Windows)?
Title: Re: Suggestion: Listbox background color
Post by: strazer on Thu 23/03/2006 12:03:05
Ashen, some of your suggestions are already on the tracker:
- GUI label background color (http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=295)
- Set inventory control's background color (http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=244)
Title: Re: Suggestion: Listbox background color
Post by: RickJ on Thu 23/03/2006 15:30:12
Quote
WinBluListbox.Height = (WinBluListbox.ItemCount * 5);
Only if the font used happened to be 5 pixels tall, and then you still haven't accounted for the top and bottom margins.   Currently there is not way to fetch the the font from the listbox so there isn't a way to know how many pixels to use for the multiplier.  A 5 poixel increment was chosen to decrease the number of iterations it takes to set the height and because 5 pixels is not very perceptable to the eye with regard to the height of a listbox. 

Quote
(Or gListbox.ItemCount, which you used. Although surely that'd be an infinite loop?)
Hardly inifinte.  The loop increases the listbox height until all of the elements in the list are in view.  There is subsequent error checking, not shown,  that limits the max size so that it fit's in the viewport.
Title: Re: Suggestion: Listbox background color
Post by: Ashen on Thu 23/03/2006 16:28:08
QuoteOnly if the font used happened to be 5 pixels tall
Ah, OK. I was assuming you knew 5 to be the font height (although it did seem a bit small). Even so, on a Box-by-Box basis, surely you'll know what font you used, and could work out the necessary difference and use that plus a fixed amount for the margins instead? I agree that a ListBox.SetRowCount(NumRows) function would be better, but the loop just seems redundant. (Although I should say, I've not tried it so I could be completely wrong.)

QuoteHardly inifinte.  The loop increases the listbox height until all of the elements in the list are in view.
I got the idea, but it looks like you're altering the size of WinBluListBox, while checking against gListbox.RowCount - and I can't see where that changes, so I got an infinite loop. I sort of assumed it was a typo, or is there something in the error checking that I've missed?

strazer:
I though they must be on already, but couldn't find them. Thanks for pointing them out.
Title: Re: Suggestion: Listbox background color
Post by: RickJ on Thu 23/03/2006 17:59:23
Quote
Even so, on a Box-by-Box basis, surely you'll know what font you used, and could work out the necessary difference and use that plus a fixed amount for the margins instead?
Since this is a script module meant for general consumption I have no way of knowing what font someone may use in the future.  I agree that the margins could probably be easily fudged.

Quote
I got the idea, but it looks like you're altering the size of WinBluListBox, while checking against gListbox.RowCount - and I
Thanks you found a bug for me.   WinBluListBox is a pointer variable and should be used in all instances.   I hadn't caught it before because gListBox is the actual control pointer and it value gets copied to the WinBluListBox variable.  Script above has been corrected.  Thanks.

Title: Re: Suggestion: Listbox background color
Post by: Pumaman on Thu 23/03/2006 23:10:37
Background colour -- this is a reasonable suggestion, as strazer points out it is already requested for other types of controls

ResizeToXRows() seems like a bit too specialized of a function to include in AGS. However, perhaps a ListBox.Font property would help?
Title: Re: Suggestion: Listbox background color
Post by: RickJ on Fri 24/03/2006 03:11:22
Thanks.  The first is probably more important/needed than the second item.  Your proposal for the second item sounds reasonable. 
Title: Re: Suggestion: Listbox background color
Post by: strazer on Fri 24/03/2006 10:20:57
Tracker'd:
- GUI Text Box background color (http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=565)
- GUI List Box background color (http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=566)
- ListBox.Font property (http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=567)