Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Oct 1, 1996

Implementing a Toolbar

Question:
I am using VB 3.0 professional edition. I would like to implement cut/copy/paste on a toolbar. My form has multiple text boxes. If the user wants to paste to a field, they click 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.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date