Mac OS X splittable window?
Yves COPPE
yvescoppe at skynet.be
Wed Sep 15 12:39:36 EDT 2004
Le 15-sept.-04, à 17:59, Frank Leahy a écrit :
> Hi,
>
> I'm looking at putting a simpler interface on my product for the next
> rev, and wanted to make it a little more Mac-like.
>
> Has anyone been able to make a splittable window in RunRev? I'm
> thinking of something like iTunes where the little dimple is in the
> middle of the bar separating the left and right panels, and when you
> mouse over it the cursor turns to a splitter, and when you drag it, it
> drags the separator bar in real time.
>
> Thanks,
> -- Frank
>
Hi Frank,
Klaus Major has written something for that
here is the script you could try and adapt to your project
It's not the original script, because I already have adapt it to my
needs.
local maydrag, maxleft,maxright
on mousedown
put true into maydrag
## In this example i set the maximum to (the width of the fields / 2)
## Change it to your needs, you can also use variables or
customproperties...
put item 1 of the loc of fld "aaa" into maxleft
put item 1 of the loc of fld "bbb" into maxright
end mousedown
on mouseup
put false into maydrag
end mouseup
on mouserelease
mouseup
end mouserelease
on mousemove x,y
if not maydrag then exit mousemove
if x < maxleft OR x > maxright then exit mousemove
## Here the restriction of the movement in the x axis!
put the rect of fld "aaa into r1
put the rect of fld "bbb" into r2
put the rect of fld "ccc" into r3
## In my example the distance between the 2 fields is ca. 20 pixel
## and the button is in the middle of them...
## That's why i use (x-10) and (x+10)!
put (x-4) into item 3 of r1
put (x+4) into item 1 of r2
put (x+4) into item 1 of r3
lock screen
set the rect of fld "aaa" to r1
set the rect of fld "bbb" to r2
set the rect of fld "ccc" to r3
set the loc of me to x, item 2 of the loc of me
unlock screen
end mousemove
on mouseEnter
set the cursor to 1977
lock cursor
end mouseEnter
on mouseLeave
unlock cursor
end mouseLeave
Hope this helps. Otherwise ask Klaus directly...
Greetings.
Yves COPPE
yvescoppe at skynet.be
More information about the use-livecode
mailing list