DKUS007

Hi,

I amd using vsto 2005 SE to create a custom toolbar. In the toolbar I have one textbox. I want to capture enter key in that textbox.

Please help me how to do that




Re: Visual Studio Tools for Office Capture enter key in a custom VSTO toolbar textbox

Cindy Meister

You mean a control of the type msoControlEdit

That has a Change event (same as the combobox) that should trigger when Enter is pressed. Trap the Change event, same way as you would the Click event for a button.






Re: Visual Studio Tools for Office Capture enter key in a custom VSTO toolbar textbox

DKUS007

Cindy,

Yes I mean a control of the type msoControlEdit.

but this change event is automatically active if i left click any other toobar button or toolbar itself.

And I don't know how to trap the change event.

Please help me






Re: Visual Studio Tools for Office Capture enter key in a custom VSTO toolbar textbox

Cindy Meister

I think you're referring to the WindowSelectionChange event, or something else. I mean the Change event that's associated with this kind of CommandBar control (an Editbox is a combobox without the dropdown list). See this message in the forum, for example:

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1781561&SiteID=1






Re: Visual Studio Tools for Office Capture enter key in a custom VSTO toolbar textbox

DKUS007

Sorry Cindy that link didn't help me.

Actually I am using c# and VSTO 2005 SE to create CommandBar control control in PowerPoint. In my commandbar I have a text box control and also I am using Change event to do some functionality. Also one of my requirement is to capture key event in that text box and do some functionality on particular key.

Please suggest me what i have to do

thanks in advance.






Re: Visual Studio Tools for Office Capture enter key in a custom VSTO toolbar textbox

DKUS007

I have a textbox(edit control) which is to function as a searchbox commandbar(VSTO 2005 SE). I want a method to be called when the user presses the enter key in this combobox.

Is there any other way for me to capture the enter key press event. The textbox only has an on change event and it fires event when I click in the textbox with a mouse and then click outside anywhere else on the command bar ( and I don't want my search to be triggered randomly like that)

Any suggestions would be most welcome.

Thanks,






Re: Visual Studio Tools for Office Capture enter key in a custom VSTO toolbar textbox

Ji Zhou ¨C MSFT

Hi DKUS007,

I know what you mean, and can reproduce the issue at my side. But only through VSTO SE, you cannot achieve that. I think what you really want is the CommandBar Control¡¯s OnAction property. It instructs a VBA procedure name. When and only when you press the enter key in the EditBox, the procedure will be executed.

But the OnAction property is not available in managed code. So to achieve what you want, we must combine VBA and VSTO.

In VSTO, we implement the search function in managed codes, and put it into a COMAddInAutomationService exposed for VBA to use. More information, you can get in Andrew¡¯s blog, here: http://blogs.msdn.com/andreww/archive/2007/01/15/vsto-add-ins-comaddins-and-requestcomaddinautomationservice.aspx

In VBA codes, we create a ppa Add-In to register the EditBox¡¯s OnAction handle. About how to create a ppa Add In, you can refer these KB articles:

http://support.microsoft.com/kb/q222737/

I have a quick test in my develop machine, and it works. Although a little complicated, but I think you can manage it by reading through the two links above. If you have any difficulty, please feel free to let me. We will do more follow up.

Thanks

Ji






Re: Visual Studio Tools for Office Capture enter key in a custom VSTO toolbar textbox

Ji Zhou ¨C MSFT

There is another thread discussed about how to assign Shortcut Key to Excel 2007. The method in that thread is very similar with this issue. For your information:

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=2227262&SiteID=1

Thanks

Ji