Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 122009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T04:03:39+00:00 2026-05-11T04:03:39+00:00

Coming from this question , I have a wxComboCtrl with a custom popup made

  • 0

Coming from this question, I have a wxComboCtrl with a custom popup made of a panel with a bunch of radiobuttons.. My problem is that when I open the popup the combo doesn’t get keystrokes, because the events get handled by the panel itself.. I’d like to redirect those KeyEvents to the textctrl of the combo, but I can’t find a way to get it to work :/
Am I going the wrong way? Should I manually handle the textctrl value as the user presses keys? I think that would be a bit cumbersome though.. Since supposedly the textctrl already knows how to handle those events..

Here’s my testcase (wxPython 2.8 on Linux), the "on_key" method should be the culprit:

import wx import wx.combo  class CustomPopup(wx.combo.ComboPopup):          def Create(self, parent):         # Create the popup with a bunch of radiobuttons         self.panel = wx.Panel(parent)         sizer = wx.GridSizer(cols=2)         for x in range(10):             r = wx.RadioButton(self.panel, label="Element "+str(x))             r.Bind(wx.EVT_RADIOBUTTON, self.on_selection)             sizer.Add(r)         self.panel.SetSizer(sizer)                  # Handle keyevents         self.panel.Bind(wx.EVT_KEY_UP, self.on_key)      def GetControl(self):         return self.panel      def GetAdjustedSize(self, minWidth, prefHeight, maxHeight):         return wx.Size(200, 150)      def on_key(self, evt):         if evt.GetEventObject() is self.panel:             # Trying to redirect the key event to the combo.. But this always returns false :(             print self.GetCombo().GetTextCtrl().GetEventHandler().ProcessEvent(evt)         evt.Skip()      def on_selection(self, evt):         self.Dismiss()         wx.MessageBox("Selection made")   class CustomFrame(wx.Frame):      def __init__(self):         # Toolbar-shaped frame with a ComboCtrl         wx.Frame.__init__(self, None, -1, "Test", size=(800,50))         combo = wx.combo.ComboCtrl(self)         popup = CustomPopup()         combo.SetPopupControl(popup)                  sizer = wx.BoxSizer(wx.VERTICAL)         sizer.Add(combo, 0)         self.SetSizer(sizer)         self.Layout()  if __name__ == '__main__':     app = wx.PySimpleApp()     CustomFrame().Show()     app.MainLoop() 

Edit:
I found these (unresolved) discussions on the same topic..
"ComboCtrl loses keyboard focus when ComboPopup is shown "
"issue using wx.ComboCtrl"

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T04:03:40+00:00Added an answer on May 11, 2026 at 4:03 am

    I’ve got an answer from Robin Dunn himself on wxpython-users:

    Sending low-level events to native widgets like this does not work the way that most people expect it to. You are expecting this to result in the character being added to the text ctrl,but it can’t do that because all that ProcessEvent does is send the wx.Event to any bound event handlers and then it stops. It does not go to the next step and convert that event to the equivalent native message and send it on to the native widget. See the ‘Simulating keyboard events’ thread.

    It doesn’t work especially well on non-Windows platforms, but you could try calling EmulateKeypress instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is not coming from a programmer. (obviously) I currently have a programmer
I have an ItemType that is coming from EF. This ItemType is wrapped in
From this question , it looks like it makes sense to have a controller
It's coming from this line of code: var dropTargetXML:XML = XMLTemplate.template.component.section.question.(@question_questionID == nNode.parent().@question_questionID)[0]; nNode
I don't understand where the extra bits are coming from in this article about
Coming from a background, I'm familiar with GUI editors that do a poor job
Coming from C++ to Java, the obvious unanswered question is why didn't Java include
Coming from C++, I find generic programming indispensable. I wonder how people approach that
I have asked this question on twitter as well the #clojure IRC channel, yet
I have asked this question in a different post here on SO: How can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.