How to Make Content Box with Scroll Bar (Like a Web Browser)

Game Editor comments and discussion.

How to Make Content Box with Scroll Bar (Like a Web Browser)

Postby dan208 » Tue Jul 24, 2007 10:59 pm

I want to make an application with this program rather than a game, because it looks like it would work great to make cross platform applications. What I am wondering is, is it possible to make a browser box with a side-scroll bar(I'm not talking a side scroller game, here :) j/k). I hope I explained it well enough, but I will jabber more to hopefully convey what I mean: basically like on a web browser on the side is the scroll bar to sift through the web page from top to bottom. Can this be done? Can this be automatically done or is this something that would need to be programmed? Thanks in advance for your help.
dan208
 
Posts: 15
Joined: Tue May 08, 2007 2:43 pm
Score: 1 Give a positive score

Postby DilloDude » Wed Jul 25, 2007 12:57 am

You would have to set up script to do this. I'd use three actors: the up arrow button, the down arrow button, and the slider in the middle. On a mouse button down event with the arrow buttons, change the slider's yscreen position by 1 (either up or down, accordingly). Add a slider mouse button down event that sets a variable, grabbed, to 1. A mouse button up event should set grabbed to 0. Add a draw actor event on slider
Code: Select all
double slidepos;
int slideamount;
if (grabbed)
{
    if (ymouse > maxy)//replace maxy with slider's position at the bottom of the bar
    {
        yscreen = maxy;
    }
    else if (ymouse < miny)//replace miny with slider's position at top of screen
    {
        yscreen = miny;
    }
    else
    {
        yscreen = ymouse;
    }
}
//that should let you drag slider up and down the bar
//next you need script to position the window. you can either move view or the window background.

//if the window size remains constant, you can precalculate some of these values, otherwise, you'll need to put them in script.

slidepos = (yscreen - miny) / (maxy - miny);
slideamount = window.height - view.height;
window.yscreen = (slidepos * slideamount) + (window.height * .5 - view.height * .5);

I think this should work, just double-check the code at the end. If you have further problems I may be able to make a demo in a few days.
Last edited by DilloDude on Wed Jul 25, 2007 4:13 am, edited 1 time in total.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby dan208 » Wed Jul 25, 2007 3:52 am

Thanks so much for your reply! That's just what I needed to know. I really appreciate your help.
dan208
 
Posts: 15
Joined: Tue May 08, 2007 2:43 pm
Score: 1 Give a positive score

Postby DarkParadox » Thu Jul 26, 2007 4:51 pm

i could really use this for one of my games
but i dont get it more details or an easier
way please.
User avatar
DarkParadox
 
Posts: 457
Joined: Mon Jan 08, 2007 11:32 pm
Location: USA, Florida.
Score: 84 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron