linking GUI

BlitzPlus Forums/BlitzPlus Programming/linking GUI

SSS(Posted 2003) [#1]
hi all, im making some gui functions, its all going well so far but i was wondering what the best way to make say a button that when pressed returned the position of a list or a scroller that when moved, moved a list...

thanks alot

Kevin_(Posted 2003) [#2]
You maybe interested in BlitzPlus rather than create your own GUI because PlitzPlus contains all these sorts of gadgets built it. Download the free demo and have alook at the samples.

Alternatively, there are numerous GUI routines floating around at


skn3(Posted 2003) [#3]
Your best way to do is like so:

Type Button
    field x,y,width,height
End type

Clicked.Button = null

    for b.Button = eahc Button
        if mousehit(1)=true and rectsoverlap(mousex(),mousey(),1,1,b\x,b\y,b\width,b\height)=true then
            Clicked.Button = B.Button
            Clicked.Button = null
        end if

    if Clicked.Button <> null then
        print Clicked\X+"  "+Clicked\Y
    end if

podperson(Posted 2003) [#4]

mousehit(1) will only return TRUE once per mouse click so your code won't work unless the user clicks on the first button. You'll need to do something like:

if mousehit(1) then
for b.button = each button


cyberseth(Posted 2003) [#5]
I usually say, at the beginning of every loop:

MouseClick = MouseHit(1)
MouseUp = (MouseDn=1) And (MouseDown(1)=0)
MouseDn = MouseDown(1)
MXspd = MouseXSpeed()
MYspd = MouseYSpeed()
MZspd = MouseZSpeed()

That usually takes care of everything. It would of course need to be modified if you want to take into account right-clicks. (MouseHit(2))