Cut,Copy,Paste menus

Ron rbarber at yhb.att.ne.jp
Sun Feb 2 17:13:01 EST 2003


Hi Howard,

This is a good coding solution that would probably address any problem I'm
having with the key itself initiating the actions. However,I think it would
not be the best solution as far as interface is concerned. eg When the user
clicks in the menu and the cursor is not in a fld, the ccp menus should not
be enabled. Or, are you saying separated the 2, cosmetically
enabling/disabling the menus and actully doing the ccp another way?

Thanks
Ron

>> 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.




More information about the use-livecode mailing list