Double Click on ComboBox: why doesn´t it work?

Hello,

thanks for handling my problem. I am running under Windows 2000, SP4,
Python 2.2.3, wxWindows 2.4.2.4.

Once more, I can work perfectly well with a combobox but I need the
delta of triggering a selected item in a special way (for instance,
running the selected item if it is an executable or displaying a web
page. Of course that I can get all characters entered in the text box
and filter them to check a special one -for instance ctrl-enter. This
does work, but it is not what I need to be consistent with the other
windows in my application: I want to select the item via the mouse
(right click, double click or whatever other action).

Interestlingly enough, this may be accomplished with a list control, but
I cannot figure out how to trigger via the mouse with a combobox.

I would really appreciate support on this.

best regards,
antonio aranda

···

--------------

Platform and version?

The behavioiur of various controls with low level events like this is

undefined and will also differ from platform to platform. The main

reason is that controls may or may not be a true native window and so

are not able to send the same kinds of notifications that true windows

do.

BTW, surpisingly I *am* getting the dclick events on the combobox

textfield for wxGTK...

--

Robin Dunn

Software Craftsman

http://wxPython.org/>

Java give you jitters? Relax with wxPython!

-------------------------------
I want to be able to perform a specific action with a selected item in a
Combobox, for instance when double clicking it.
The related event, EVT_LEFT_DCLICK , seems not to work in the
combobox. Actually, the only event that seems to work in the combobox
text field is EVT_MOTION, but only when I get into it or out of it.

I need some way to click on a selected item of a combobox in a special
way (right click, double click or whatever) and perform a special
action.

I have been working on this for some days with no avail.

I would appreciate a solution to this issue.
I provide a small sample code to verify what I say above.

thanks
antonio

sample code:

from wxPython.wx import *

class MainFrame(wxFrame):
    def __init__(self):
        wxFrame.__init__(self, None, -1, "EVT_MOTION Test")

        self.SetSize(wxSize(400, 380))
        self.panel = wxPanel (self, -1)

        EVT_CLOSE(self, self.OnCloseWindow)
        EVT_MOTION (self.panel, self.panel_motion)
        EVT_LEFT_DOWN (self.panel, self.panel_left_down)
        EVT_LEFT_DCLICK (self.panel, self.panel_left_dclick)
        EVT_LEFT_UP (self.panel, self.panel_left_up)

        self.button = wxButton (self.panel, -1, 'A Button',
pos=(100,100))
        EVT_MOTION (self.button, self.button_motion)
        EVT_LEFT_DOWN (self.button, self.button_left_down)
        EVT_LEFT_DCLICK (self.button, self.button_left_dclick)
        EVT_LEFT_UP (self.button, self.button_left_up)
        EVT_BUTTON (self.button, self.button.GetId (),
self.button_clicked)

        self.cb= wxComboBox(self.panel, -1,
                            "",
                            choices=["aaaaa","bbbbb","cccc"],
                            pos=(-1,-1),# default
                            size=(-1,-1),# default
                            style=wxCB_SIMPLE # creates a combobox with
a drom-down list
                           )

        EVT_MOTION (self.cb, self.cb_motion)
        EVT_LEFT_DOWN (self.cb, self.cb_left_down)
        EVT_LEFT_DCLICK (self.cb, self.cb_left_dclick)
        EVT_LEFT_UP (self.cb, self.cb_left_up)
        EVT_BUTTON (self.cb, self.cb.GetId (), self.cb_clicked)
        EVT_LEFT_DCLICK (self.cb, self.cb_left_dclick)

    def OnCloseWindow(self, event):
        self.Destroy()

    def panel_motion (self, event):
        print 'Panel motion'

    def panel_left_down (self, event):
        print 'Panel left down'

    def panel_left_dclick (self, event):
        print 'Panel left dclick'

    def panel_left_up (self, event):
        print 'Panel left up'

    def button_motion (self, event):
        print 'Button motion'

    def button_left_down (self, event):
        print 'Button left down'

    def button_left_dclick (self, event):
        print 'Button left dclick'

    def button_left_up (self, event):
        print 'Button left up'

    def button_clicked (self, event):
        print 'Button clicked'

    def cb_clicked (self, event):
        print 'CB clicked'

    def cb_motion (self, event):
        print 'CB motion'

    def cb_left_down (self, event):
        print 'CB left down'

    def cb_left_dclick (self, event):
        print 'CB left dclick'

    def cb_left_up (self, event):
        print 'CB left up'

    def cb_clicked (self, event):
        print 'CB clicked'

class TestApp(wxApp):
    def OnInit(self):
        self.frame = MainFrame()
        self.frame.Show(True)
        self.SetTopWindow(self.frame)
        return True

app = TestApp(0)
app.MainLoop()

Antonio Aranda Germany

Aranda, Antonio wrote:

Hello,

thanks for handling my problem. I am running under Windows 2000, SP4,
Python 2.2.3, wxWindows 2.4.2.4.

Once more, I can work perfectly well with a combobox but I need the
delta of triggering a selected item in a special way (for instance,
running the selected item if it is an executable or displaying a web
page. Of course that I can get all characters entered in the text box
and filter them to check a special one -for instance ctrl-enter. This
does work, but it is not what I need to be consistent with the other
windows in my application: I want to select the item via the mouse
(right click, double click or whatever other action).

Interestlingly enough, this may be accomplished with a list control, but
I cannot figure out how to trigger via the mouse with a combobox.

I would really appreciate support on this.

Well if the native control doesn't support it there is not much we can do about it from wxPython other than create a custom control from scratch that behaves the way you want...

Part of the problem may be that the drop-down part of the combo box may be implemented as a separate window that is totally managed by the combo control itself. In that case the low level messages/callbacks/events or whatever are not delivered to a place that can be captured by wxWindows. Does the double click on the textctrl part of the combobox work for you?

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!