Setting an accelerator on a SearchCtrl

Hello,

I have a SearchCtrl control and I want to set an accelerator on it, so when the user presses e.g. Alt-e, focus will go to the search box.

I tried doing this in the usual way, putting a label of “S&earch for simpacks.” But it just showed the & normally instead of making an underline.

How do I do this?

Thanks,

Ram.

When you say label do you mean a wx.StaticText or the initial text shown in the search ctrl? Which platform?

···

On 4/12/11 3:26 PM, cool-RR wrote:

Hello,

I have a `SearchCtrl` control and I want to set an accelerator on it, so
when the user presses e.g. Alt-e, focus will go to the search box.

I tried doing this in the usual way, putting a label of "S&earch for
simpacks." But it just showed the & normally instead of making an underline.

How do I do this?

--
Robin Dunn
Software Craftsman

I mean the initial text shown in the search control.

I’m developing on XP, but I want something that works on all platforms.

Ram.

Auto-accelerators like that only work if you do it in a wx.StaticText that comes before (in the tab-order) the widget to be jumped to. This should work for Windows, and perhaps GTK. I don't think that the Mac has equivalent native behavior so I don't think that wx does anything for it there.

···

On 4/13/11 2:26 PM, cool-RR wrote:

I mean the initial text shown in the search control.

I'm developing on XP, but I want something that works on all platforms.

--
Robin Dunn
Software Craftsman

Cool, this seems to work well on both Windows and GTK.

By the way, it seems that Google Groups is malfunctioning; I didn’t get any email notifications for this thread, even though I set email notifications to be sent. (And I can still see it’s set to send them.) Just an FYI, so if I miss any messages, this is probably the reason.

Ram.