Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Coyp and Paste Popup Menu

Status
Not open for further replies.

cwalshe

Programmer
May 28, 2001
84
IE
HI there,

I am wondering if this is possible:

I would like to create my own popup menu that will allow me to (a) copy and (b) paste, either text or graphics.

I would like this to be a separate menu to the normal menu when you right click, or perhaps even better, an add on to the existing menu (obviously, the copy and paste names would be changed to avoid confusion).

Any ideas,

Cormac.
 
Any idea of how I would go about doing this for copy and paste.
 
Hi

Well I think most of your question relates to how to show a popup menu in the first place.

You need an existing menu (if you don't want this to appear on the main menu you can set it's visible prop to false but from the sound of things you do want it on the main menu as well)

Then in the mouse_up event for the control, you can put code something like this

Private Sub flbQueue_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 2 Then 'right
Me.PopupMenu Me.mnuPopUpQueue, vbPopupMenuRightButton
End If

End Sub

A form has a method called PopUpMenu which just shows the specified menu control as a pop-up - look this method up in the help

As for changing the names, you could just set the caption properties of the menu controls in the mouse up event and in the parent menu control's click event.

Does this help?

Go n-eiri an bothair leat!
Mark
 
Hi again
For pasting and copying you need to check out the clipboard object.

For example, for a textbox, this is what I would do

Me.Text1.SelText = Clipboard.GetText

Hope this helps

Mark
 
Ok, so basically this is what I think that I want to happen, while my vb ap is running in the background, I'd like to be able to

a) add two new menu item to that right click menu that allows appear, regardless of what open app is open

b) these two menu items will copy and paste whatever has been selected.

Slan go foill,

Cormac.
 
Hmmmm

I thought you just wanted to do this for your own app. Not sure how you would go about adding items to the context menus for other applications. There might be some API functions which do that, but I doubt it. I'll have a look when I get time.

One of the reasons which this would be undesirable is say a program has a password text box. Normally, a programmer will disable the copy pop-up for that text box for security reasons. Windows would not be very secure if another program could just override the programmers wishes that way.

Anyway

Slan leat

Mark
 
Ok, so not to be a nuisance but would this be possible. To create a two option pop up menu that allowed me to copy and paste. However, I'd like my app to run in the background, i.e. while my app was working and if I right clicked on any active doc, only 'my menu' would appear. Basically if my app was running I could go to a website and copy text from it using my menu, rather than the normal one.

Slan,

Cormac.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top