Question:
I am using VB 3.0 professional edition. I would like toimplement cut/copy/paste on a toolbar. My form has multipletext boxes. If the user wants to paste to a field, theyclick on the insertion point, then click on the paste button.How can I tell which field they were on? ActiveControl gets set to -1.
Answer:
Do you actually have buttons in the toolbar, or are you using pictures? If you use buttons, the activecontrol will actually change. Pictures can’t be set to the activecontrol, so the problem goes away. I think most of the 3rd party toolbars (I use Sheridan’s) use pictures instead of buttons.
However, if you do want to implement a toolbar without a specialized control, you’ll need to keep track of which control last had the focus. Once the user presses a button, use the last control that was used for cut/copy/paste.