ToolStripTextBox right click

G

Guest

hi there,
does anyone know how to prevent the context menu on a ToolStripText box from
appearing?

when i right click on the toolstriptextbox i get presented with the system
undo
 
N

Nicholas Paldino [.NET/C# MVP]

Brian,

In order to do this, you would have to disable the right click
functionality of the toolbox, I believe. You can derive from TextBox, and
then override the WndProc method to intercept the WM_RBUTTONDOWN
notification.

Hope this helps.
 
G

Guest

Hi Nicholas,

I tried to take this approack by not handling the WM_CONTEXTMENU = 0x007b;
in the WndProc but...
ToolStripTextBox doesn not derive from control. so there is no wndproc,
So i tried to do it with the ToolStrip itself but to no affect.
I'll figure it out somehow when i get back to it and i'll post the solution.
thanks
Brian

Nicholas Paldino said:
Brian,

In order to do this, you would have to disable the right click
functionality of the toolbox, I believe. You can derive from TextBox, and
then override the WndProc method to intercept the WM_RBUTTONDOWN
notification.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Brian Keating said:
hi there,
does anyone know how to prevent the context menu on a ToolStripText box
from
appearing?

when i right click on the toolstriptextbox i get presented with the system
undo
------
cut
copy
paste
-----
delete

context menu, i need to disable this menu showing.
any ideas?
 
N

Nicholas Paldino [.NET/C# MVP]

Brian,

I just noticed that. In order to get around this, you can get the
hosted TextBox by calling the TextBox property. Then, you should be able to
create a class derived from NativeWindow which overrides the WndProc method
to ignore the context menu message.

When you get the textbox property, get the handle, and assign the handle
to your overridden NativeWindow class.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Brian Keating said:
Hi Nicholas,

I tried to take this approack by not handling the WM_CONTEXTMENU = 0x007b;
in the WndProc but...
ToolStripTextBox doesn not derive from control. so there is no wndproc,
So i tried to do it with the ToolStrip itself but to no affect.
I'll figure it out somehow when i get back to it and i'll post the
solution.
thanks
Brian

Nicholas Paldino said:
Brian,

In order to do this, you would have to disable the right click
functionality of the toolbox, I believe. You can derive from TextBox,
and
then override the WndProc method to intercept the WM_RBUTTONDOWN
notification.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Brian Keating said:
hi there,
does anyone know how to prevent the context menu on a ToolStripText box
from
appearing?

when i right click on the toolstriptextbox i get presented with the
system
undo
------
cut
copy
paste
-----
delete

context menu, i need to disable this menu showing.
any ideas?
 
G

Guest

Hi Nicholas, excellen, u def deserve the MVP!
I didn't know about the TextBox property, thanks alot, i'm home free now.

regds
Brian

Nicholas Paldino said:
Brian,

I just noticed that. In order to get around this, you can get the
hosted TextBox by calling the TextBox property. Then, you should be able to
create a class derived from NativeWindow which overrides the WndProc method
to ignore the context menu message.

When you get the textbox property, get the handle, and assign the handle
to your overridden NativeWindow class.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Brian Keating said:
Hi Nicholas,

I tried to take this approack by not handling the WM_CONTEXTMENU = 0x007b;
in the WndProc but...
ToolStripTextBox doesn not derive from control. so there is no wndproc,
So i tried to do it with the ToolStrip itself but to no affect.
I'll figure it out somehow when i get back to it and i'll post the
solution.
thanks
Brian

Nicholas Paldino said:
Brian,

In order to do this, you would have to disable the right click
functionality of the toolbox, I believe. You can derive from TextBox,
and
then override the WndProc method to intercept the WM_RBUTTONDOWN
notification.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

hi there,
does anyone know how to prevent the context menu on a ToolStripText box
from
appearing?

when i right click on the toolstriptextbox i get presented with the
system
undo
------
cut
copy
paste
-----
delete

context menu, i need to disable this menu showing.
any ideas?
 

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