|
-
Oct 31st, 2001, 05:17 PM
#1
Thread Starter
Need-a-life Member
Copying to Clipboard through Toolbar
I´m using this code:
VB Code:
Public Sub submnuCopy_Click()
Clipboard.Clear
If TypeOf Screen.ActiveControl Is TextBox Then
Clipboard.SetText Screen.ActiveControl.SelText
ElseIf TypeOf Screen.ActiveControl Is ComboBox Then
Clipboard.SetText Screen.ActiveControl.Text
ElseIf TypeOf Screen.ActiveControl Is PictureBox Then
Clipboard.SetData Screen.ActiveControl.Picture
ElseIf TypeOf Screen.ActiveControl Is ListBox Then
Clipboard.SetText Screen.ActiveControl.Text
Else
' No action makes sense for the other controls.
End If
End Sub
How do I do to make it work through a Toolbar. The problem is that if I click on the Copy button, I'm getting that the Screen.ActiveControl is set to nothing. How do I change this?
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Oct 31st, 2001, 06:41 PM
#2
Frenzied Member
Boy, that is a problem. What if you tried setting an Object variable in the ToolBar_MouseMove event. That event would fire before the active control lost focus.
You might then be able to do It TypeOf ObjectVar is TextBox Then...
Greg
Free VB Add-In - The Reference Librarian
Click Here for screen shot and download link.
-
Oct 31st, 2001, 07:06 PM
#3
Thread Starter
Need-a-life Member
-
Oct 31st, 2001, 07:28 PM
#4
Frenzied Member
Free VB Add-In - The Reference Librarian
Click Here for screen shot and download link.
-
Oct 31st, 2001, 07:50 PM
#5
Frenzied Member
I've seen this solved before by keeping a public variable containing the name of the last control that has focus, then you read from that, and use that to decide what control it is
Government is another way to say better…than…you.
It’s like ice but no pick, a murder charge that won’t stick,
it’s like a whole other world where you can smell the food,
but you can’t touch the silverware.
Huh, what luck. Fascism you can vote for.
Humph, isn’t that sweet?
And we’re all gonna die some day, because that’s the American way
-Stone Sour
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|