ContextMenuStrip steals focus?

R

Ryan Ross

Hello All,

I have a small problem. I have a RichTextBox, which calls a
ContextMenuStrip, when a user types certain text. The problem I am
faced
with is that I cannot return the focus (keyboard input, etc.) to the
RichTextBox, once the ContextMenuStrip opens.

When the ContextMenuStrip opens, I'd like the keyboard input to
continue for
the RichTextBox.

Does anyone know how to accomplish this task?

Thanks,
Ryan
 
J

Jeff Gaines

Hello All,

I have a small problem. I have a RichTextBox, which calls a
ContextMenuStrip, when a user types certain text. The problem I am
faced
with is that I cannot return the focus (keyboard input, etc.) to the
RichTextBox, once the ContextMenuStrip opens.

When the ContextMenuStrip opens, I'd like the keyboard input to
continue for
the RichTextBox.

That might make it a bit difficult for a user to select an item from the
menu...
Does anyone know how to accomplish this task?

It's not really how menus are supposed to work.
 
J

Jeff Johnson

I have a small problem. I have a RichTextBox, which calls a
ContextMenuStrip, when a user types certain text. The problem I am
faced
with is that I cannot return the focus (keyboard input, etc.) to the
RichTextBox, once the ContextMenuStrip opens.

When the ContextMenuStrip opens, I'd like the keyboard input to
continue for
the RichTextBox.

Why? Seriously, WHY?
Does anyone know how to accomplish this task?

No, nor do I hope it's possible. When a menu appears it should have focus.
If it loses focus it should disappear. That's what menus do. It sounds like
you want a floating toolbox-like window which contains commands. If so, make
one. Do not try to force the square menu into the round hole you're looking
for.
 
R

Ryan W. Ross

Hmm.

You've used Visual Studio, right? You know how everyone likes Intellisense?
Same idea here. Intellisense is nothing more than a ContextMenuStrip (or
something akin to it), which pops up when you are typing in a text editor
(well, IDE, but you understand what I am getting at here). In short, I am
attempting to replicate some Intellisense functionality for an application
I'm developing.

You can continue typing in the text editor even when the ContextMenuStrip is
open. Perhaps I am misusing the word focus here, but I believe I have now
conveyed what I am after.

Thanks,
Ryan

BTW, does this newsgroup allow posting of images (screenshots?). I tried to
send a post with a screenshot earlier, and it hasn't appeared...
 
J

Jeff Johnson

You've used Visual Studio, right? You know how everyone likes
Intellisense? Same idea here. Intellisense is nothing more than a
ContextMenuStrip (or something akin to it), which pops up when you are
typing in a text editor (well, IDE, but you understand what I am getting
at here). In short, I am attempting to replicate some Intellisense
functionality for an application I'm developing.

You can continue typing in the text editor even when the ContextMenuStrip
is open. Perhaps I am misusing the word focus here, but I believe I have
now conveyed what I am after.

It's not a menu; it's a specialized control that kind of looks like a menu.
Look at it closer: it really looks a lot more like a floating combo box (the
dropdown portion only, not the stuff at the top). Since the little sucker is
really sensitive to focus changes I can't use Spy++ to tell what it really
is, but I can assure you it's not a menu. And if you've ever seen VB's
version of it it even has tabs at the bottom. Totally custom control.
BTW, does this newsgroup allow posting of images (screenshots?). I tried
to send a post with a screenshot earlier, and it hasn't appeared...

It's generally considered rude to post a binary to a group that doesn't have
".binaries." in its name, so it's probably a good thing that you couldn't
post. The next best thing is to put it on the Web somewhere and put a link
to it in your post.
 
J

Jeff Gaines

You've used Visual Studio, right? You know how everyone likes
Intellisense? Same idea here. Intellisense is nothing more than a
ContextMenuStrip (or something akin to it), which pops up when you are
typing in a text editor (well, IDE, but you understand what I am getting
at here). In short, I am attempting to replicate some Intellisense
functionality for an application I'm developing.

You can continue typing in the text editor even when the ContextMenuStrip
is open. Perhaps I am misusing the word focus here, but I believe I have
now conveyed what I am after.

OK, understood now :)

The Code Project is a good place to look, for example:
http://www.codeproject.com/KB/edit/codetextbox.aspx

There are other examples there as well if you search their site.
 
R

Ryan W. Ross

Thank You for your assistance.

-Ryan



Jeff Johnson said:
It's not a menu; it's a specialized control that kind of looks like a
menu. Look at it closer: it really looks a lot more like a floating combo
box (the dropdown portion only, not the stuff at the top). Since the
little sucker is really sensitive to focus changes I can't use Spy++ to
tell what it really is, but I can assure you it's not a menu. And if
you've ever seen VB's version of it it even has tabs at the bottom.
Totally custom control.


It's generally considered rude to post a binary to a group that doesn't
have ".binaries." in its name, so it's probably a good thing that you
couldn't post. The next best thing is to put it on the Web somewhere and
put a link to it in your post.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top