Custom Menu Cut, Copy & Paste
Posted on 2006-11-02
I am trying to make an application that uses a custom menu bar for most actions, rather than my typical collection of buttons. Most things are going well, but I am getting hung up on Cut, Copy and Paste. I have thought through the problem down various paths and cannot find one I am happy with. I am hoping to get some feedback.
I have a main form that is always open and it has various text boxes and a few subforms in continuous mode. The problem is that standard Cut/Copy/Paste works great for text boxes and simple subforms, but doesn't work correctly if the user selects an entire record in a subform that links to other tables in a 1-to-many relationship. All the information could be deleted by the Cut using cascading delete, but it will not be properly saved by the Cut or Copy or Pasted correcly.
But if I replace the standard Cut, Copy, Paste then I have to somehow handle disabling them in various situtations --like no text selection, focus is on a command button, etc. This seems time consuming and error prone.
Ideally, I could simply replace Cut, etc. with "Cut Entire Record", etc. when an entire record is selected and show standard Cut, etc. when it is not. I could track the record selector being clicked with the subform's OnMouseDown event, but I see no way to easily track when the focus leaves the record selector.
My final idea is to hide the record selector and any way for the user to select an entire record and make a fake one myself. Then I would never have o worry about standard Cut morphing into incorrect full record Cut. This could work but I always find these little tweaks turn into hair pullers once I get into them.
So that's where I am...1. Drop standard C/C/P and lose auto disabling, 2. Disable standard C/C/P when record is selected, 3. Drop record selectors and fake my own.
If you made it this far, thanks! Any thoughts...?