Implement clipboard operations via menu


I’m developing my first commercial Firemonkey application (also my first commercial application in any language). I have used native FMX controls and also one control from TMSSoftware (TTMSFMXGrid). The keyboard clipboard operations — Ctrl+X, Ctrl+C, Ctrl+V — work “out of the box”. But I would like my application to provide menu items with the same functionality as the keyboard shortcuts.

I have set my program up so that there is a TMenuBar visible when compiling for Windows. When compiling for OS X, the TMenuBar is invisible but a TMainMenu comes up instead. For simplicity, we could just discuss the scenario of compiling for Windows when the TMenuBar is visible.

It’s easy to program the TMenuItems of TMenuBar to perform the cut, copy and paste operations. That is not the issue. I have been unable to figure out how to disable the cut and copy menu items when nothing (or nothing relevant) is selected and how to disable the paste when there is nothing (or nothing relevant) on the clipboard.

How can I do that?

(I am using Berlin 10.1 Update 2.)

Comments are closed.