paste graphic on mousedown

Jan Schenkel janschenkel at
Thu Nov 14 01:59:01 EST 2002

--- Kurt Kaufman <kkaufman at> wrote:
> I need to be able to paste small graphic objects
> with one click.  In 
> other words, keep a graphic on the clipboard and
> paste numerous times 
> at locations determined by the point of the arrow
> cursor. -Sort of like 
> an ink "stamp". There would be a few different
> graphics to choose from, 
> and they could be selected by keyboard shortcut, or
> by clicking on a 
> palette. The "stamped" graphics must be moveable.
> Does anyone have a suggestion as to the most
> efficient way of doing 
> this?
> Thank you,
> Kurt

Hi Kurt,

The simples apprach would be to have the different
'stamps' as a few buttons with a script like:

on mouseUp
  global gPuttingStamps, gCurrentStamp
  set the hilite of me to not the hilite of me
  put the hilite of me into gPuttingStamps
  put "stamps\"&(the name of me) into gCurrentStamp
end mouseUp

Try this in your card script:

on mouseUp
  global gPuttingStamps
  if gPuttingStamps then
    -- might want to check for boundaries here
    -- ...
    -- create the image, save ID, reset cursor
    create image
    put it into tID
    choose browser tool
    -- set height, width and location
    set the height of image tID to \
    set the width of image tID to \
    set the location of image tID to the clickLoc
    -- set the correct stamp image
    set the fileName of image tID to gCurrentStamp
    -- make sure we get the message again later
    -- in case the user clicks on one of our images
    set the script of image tID to \
      "on mouseUp" & return & "pass mouseUp" & \
      return & "end mouseUp"
    -- and we're all set :-)
  end if
end mouseUp

You'll have to prepare the necessary data of course,
but this general approach should work like a charm.

Hope this helped,

Jan Schenkel.

"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site

More information about the Use-livecode mailing list