How do I make scrollbars not look terrible?

Started by Gurok, Wed 26/02/2014 23:40:29

Previous topic - Next topic

Gurok

I am working on save and load GUIs at the moment and I'd like to know what other people do to avoid using those terrible built-in scrollbars. At the moment, I am thinking of doing this:



But I'd like to know if somebody has implemented proper scrollbars as a module that I can just use.
[img]http://7d4iqnx.gif;rWRLUuw.gi

Ghost

#1
Looking at your mock-up I had to smile; I am using a very similar setup in a WiP of mine:

It's really simple actually. You just need two buttons that manipulate a listbox (and the listbox must have its scrollbars hidden)- even more, all you ever do is set the list's TopItem.
The 9Verb template that comes with AGS uses the same approach, so if you are looking for specific code, it's already in your copy of AGS.

My stripped-down code for both buttons:

Top of GlobalScript:
Code: ags

int iFileTracker = 0; 			// variable to iterate savegame box
int cMaxSaves = 100; 			// how many saves are allowed, at max
int cMaxFiles = 15; 			// mow many saves can be shown at once in the file list


Code: ags

function btnFilesScrollUp_OnClick(GUIControl *control, MouseButton button)
{
	lstFiles.SelectedIndex = -1;
	
	if (iFileTracker < 5)
		iFileTracker = 0;
	else
		iFileTracker -= 5;
		
	lstFiles.TopItem = iFileTracker;	
}

// scroll file list down
function btnFilesScrollDown_OnClick(GUIControl *control, MouseButton button)
{
	lstFiles.SelectedIndex=-1;
	
	// we advance the list by five...
	iFileTracker += 5;
	// then we check if there would be "empty fields" in the list
	// if that is the case, we manually calculate the stopsaveitem
	if (iFileTracker > cMaxSaves - cMaxFiles)
		iFileTracker = cMaxSaves - cMaxFiles;
	lstFiles.TopItem=iFileTracker;	
}


Result:

Gurok

Thanks for the snippet, Ghost. Now that I know, I'll just check out the 9Verb template if I get stuck. Your save GUI looks great, by the way.
[img]http://7d4iqnx.gif;rWRLUuw.gi

SMF spam blocked by CleanTalk