More about images
Ken Norris (dialup)
pixelbird at interisland.net
Fri Feb 7 23:48:02 EST 2003
**********
Hi Jan,
----------
> Date: Thu, 6 Feb 2003 01:29:38 -0800 (PST)
> From: Jan Schenkel <janschenkel at yahoo.com>
> Subject: Re: More about images
>> I'd rather write a
>> simple routine that will do the same as it does in
>> HC with Uli's xDraw: Draw
>> corresponding button rects of the DOWN state image.
----------
See what I need the screen to draw? The main image looks like a computer
keyboard with all the keys in the UP position, and has 76 transparent
buttons over the "key" simulations in the image. When you move the cursor
over a "key" and press the mouse, you are sending a mouseDown to the
transparent button. In my HC version, this simulates a "key" press by using
the rect of the button to display _only_ that same _portion_ of the
DOWN-state image which is in memory. The basic call (just for the display,
not other actions) with the XCMD in HC looks like this:
on theKey
GLOBAL gBgGW_id
lock screen
get xGWorld( "lock",gBgGW_id )
get xGWorld( "draw",gBgGW_id,rect of the target, rect of the target, the
id of card window )
get xGWorld( "unlock",gBgGW_id )
play "kyDnSnd"
wait until the mouse is up
unlock screen -- redraw screen when mouse is released
play "kyUpSnd"
end theKey
...It performs a kind of cookie cutter thing: displays a rect of a matching
_portion_ of the DOWN image over the same position of the Up image.
----------
> Hi Ken,
>
> Try this scenario:
> - group the "Down" image (yes, just the one image)
> - set the rect of the group to the rect you want to
> display every time
----------
If I understand you correctly, I think that will resize the whole image, and
we'll end up with a miniature of the whole keyboard, won't it?
----------
> - set the lockLocation of the group to true
> - hide the group
> Then when you need to display:
> - set the hScroll of group "DOWN" to X
> - set the vScroll of group "DOWN" to Y
> - show group "DOWN"
----------
That will scroll the whole grouped DOWN image somewhere...won't work either.
----------
> That ought to do the trick.
----------
Thanks for trying. Maybe I just don't fully understand what happens if you
group the image. It has to be in a background behavior thing anyway.
Ken N.
More information about the use-livecode
mailing list