Cut,Copy,Paste menus

Howard Bornstein bornstein at designeq.com
Sun Feb 2 16:08:18 EST 2003


>Currently, I enable 'copy' when the menubar group gets a mousedown message,
>just as you suggested. eg On mousedown and text is selected, then enable
>'copy'. This works fine since it is 'just in time'. However, let's say I
>open a fld, then select some text. The 'copy' menu should now be enabled,
>but since I have not clicked in the menubar, the 'copy' menu is still in its
>default state of disabled. Thus when the cmdkey is sent to the menubar,
>nothing happens. 


Why not just handle the command keys directly?

on commandkeydown keyname
  if the selection is not empty then
    switch keyname
    case "c"
      copy
      break
     
    case "x"
      cut
      break
     
    case "v"
      paste
      break
    end switch
  end if
  pass commandkeydown
end commandkeydown

Then you don't have to worry about the state of the menu.


Regards,

Howard Bornstein
____________________
D E S I G N  E Q
www.designeq.com



More information about the use-livecode mailing list