467,926 Members | 1,753 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,926 developers. It's quick & easy.

how to enable/disable paste

Here's my newbie question:

I have several VB forms which are all inherit a standard template form
that I made. In my template form, I added a menu bar with some
generic cut, copy, and paste functionality.

I'd like to have the paste button disabled when the clipboard is
empty, but I'm not sure how I should do this. Ideally, I suppose I'd
like to constantly monitor the clipboard for data, (in a thread?) but
I'm not even sure how I'd monitor the clipboard.

while (1==1)
if clipboard != mt
enable paste
else
disable paste

Or maybe there there's an event that I could monitor?

on Event
if clipboard != mt
enable paste
else
disable paste

What's the best way to tackle this?

TIA
Nov 20 '05 #1
  • viewed: 6298
Share:
3 Replies
well i think there must be an event somewhere but I don't know where...

the while(1=1) is a bad idea, will use too much cpu...
something you can also use is listen on the popup event of the menuitem to
dis/enable your menuitem...

hope this helps

dominique
"Stilgar[bbs.isca.uiowa.edu]" <no****@yakhair.com> wrote in message
news:4d*************************@posting.google.co m...
Here's my newbie question:

I have several VB forms which are all inherit a standard template form
that I made. In my template form, I added a menu bar with some
generic cut, copy, and paste functionality.

I'd like to have the paste button disabled when the clipboard is
empty, but I'm not sure how I should do this. Ideally, I suppose I'd
like to constantly monitor the clipboard for data, (in a thread?) but
I'm not even sure how I'd monitor the clipboard.

while (1==1)
if clipboard != mt
enable paste
else
disable paste

Or maybe there there's an event that I could monitor?

on Event
if clipboard != mt
enable paste
else
disable paste

What's the best way to tackle this?

TIA

Nov 20 '05 #2
I can't listen for the pop-up event because I'm also using the
standard cut, copy, paste shortcut keys (ctrl-x, ctrl-c, ctrl-v),
unless using the shortcut keys activates the menu event too??? I
guess I'll have to try that.

You're right about using "while(1==1)" using a lot of CPU, that's why
I'd make my application multithreaded and use VB's equivalent of
wait() or sleep().

"Dominique Vandensteen" <domi.vds_insert@tralala_tenforce.com> wrote in message news:<uY**************@tk2msftngp13.phx.gbl>...
well i think there must be an event somewhere but I don't know where...

the while(1=1) is a bad idea, will use too much cpu...
something you can also use is listen on the popup event of the menuitem to
dis/enable your menuitem...

hope this helps

dominique
"Stilgar[bbs.isca.uiowa.edu]" <no****@yakhair.com> wrote in message
news:4d*************************@posting.google.co m...
Here's my newbie question:

I have several VB forms which are all inherit a standard template form
that I made. In my template form, I added a menu bar with some
generic cut, copy, and paste functionality.

I'd like to have the paste button disabled when the clipboard is
empty, but I'm not sure how I should do this. Ideally, I suppose I'd
like to constantly monitor the clipboard for data, (in a thread?) but
I'm not even sure how I'd monitor the clipboard.

while (1==1)
if clipboard != mt
enable paste
else
disable paste

Or maybe there there's an event that I could monitor?

on Event
if clipboard != mt
enable paste
else
disable paste

What's the best way to tackle this?

TIA

Nov 20 '05 #3
I don't see the problem with the shortcut keys. I suppose you listen for the
keyevent for that.
When you receive the keyevent just check the clipboard like you do in the
popup event.
If the clipboard is empty (for ctrl-v) just return...

Dominique
"Stilgar[bbs.isca.uiowa.edu]" <no****@yakhair.com> wrote in message
news:4d************************@posting.google.com ...
I can't listen for the pop-up event because I'm also using the
standard cut, copy, paste shortcut keys (ctrl-x, ctrl-c, ctrl-v),
unless using the shortcut keys activates the menu event too??? I
guess I'll have to try that.

You're right about using "while(1==1)" using a lot of CPU, that's why
I'd make my application multithreaded and use VB's equivalent of
wait() or sleep().

"Dominique Vandensteen" <domi.vds_insert@tralala_tenforce.com> wrote in

message news:<uY**************@tk2msftngp13.phx.gbl>...
well i think there must be an event somewhere but I don't know where...

the while(1=1) is a bad idea, will use too much cpu...
something you can also use is listen on the popup event of the menuitem to dis/enable your menuitem...

hope this helps

dominique
"Stilgar[bbs.isca.uiowa.edu]" <no****@yakhair.com> wrote in message
news:4d*************************@posting.google.co m...
Here's my newbie question:

I have several VB forms which are all inherit a standard template form
that I made. In my template form, I added a menu bar with some
generic cut, copy, and paste functionality.

I'd like to have the paste button disabled when the clipboard is
empty, but I'm not sure how I should do this. Ideally, I suppose I'd
like to constantly monitor the clipboard for data, (in a thread?) but
I'm not even sure how I'd monitor the clipboard.

while (1==1)
if clipboard != mt
enable paste
else
disable paste

Or maybe there there's an event that I could monitor?

on Event
if clipboard != mt
enable paste
else
disable paste

What's the best way to tackle this?

TIA

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Alphonse Giambrone | last post: by
reply views Thread by talal | last post: by
2 posts views Thread by JohnProgrammer | last post: by
8 posts views Thread by rongchaua | last post: by
6 posts views Thread by =?Utf-8?B?TWljaGFlbCAwMw==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.