Reputation: 438
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.)
Upvotes: 2
Views: 1277
Reputation: 937
You can read about Copy/Cut/Paste with FMX from Embarcadero here:
Multi-Device Apps and Clipboard Support
And because your question is about Windows now you should understand internals of Windows Clipboard. Good start is article from Zarko Gajic:
Basic Clipboard Operations (Cut/Copy/Paste)
And also about listening Clipboard to reseive notifications about clipboard content changing:
Listening to the Clipboard: Clipboard Delphi Spy with Custom Clipboard Formats
Another good article about clipboard in OS X and Windows with FMX:
Copying and pasting the contents of a FireMonkey TBitmap
Upvotes: 0