help with customtreectrl combopopup

Hello, list. I’m trying to create a ComboCtrl that has as its popup a CustomTreeCtrl, and I’m having some trouble getting what I’d like to see. (WinXP, Python 2.5, wxPython 2.8.10.1).

What I would like is a ComboCtrl that pops up a rather simple-looking CustomTreeCtrl: items without a root, buttons, or lines, and with each item having a checkbox. When that checkbox is checked, the item should expand to show another item below it, which is the word “Note:” with a textCtrl to the right of it. The idea is to allow a list of items to be selected, but with the option to add a note to checked items.

Attached is a small runnable sample that shows an almost-there example, but also shows four problems I have. They are:

  1. The items are displaced to the right by a noticeable amount. This is the same amount of space that would have been taken up by the buttons if they had been there. I would instead like the checkboxes to be almost flush to the left hand side of the dropdown (like a ListBox).

  2. In order to have the effect where checking or unchecking a checkbox expands or collapses a node, it seems I need to include the line:

self.tree.SetItemBold(item)

(or the one that unbolds it) Why? That seems like it should be independent of Expand() or Collapse(), but if both occasions of those lines are commented out, the node doesn’t do either. I would like the option to not necessarily have the checked item turn bold.

  1. I cannot type in the TextCtrl. I thought this was an issue of that I parented it to the wrong control, but I’ve tried the ComboCtrl, the popup (here, self.tcp), and the CustomTreeCtrl and only the CustomTreeCtrl works at all–but I can’t type in it/edit it.

  2. When any node does Collapse(), its TextCtrl remains there, uncollapsed.

Any help is, as always, appreciated.

Also, if anyone has suggestions for achieving this same sort of GUI with a different approach, I’d love to hear them. Basically I want a nice-looking and compact way to check off a number of items and optionally add very brief notes to checked items.

Thanks,
Che

customtreectrl_sample_app.py (4.77 KB)

···

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Hello, list. I'm trying to create a ComboCtrl that has as its popup a
CustomTreeCtrl, and I'm having some trouble getting what I'd like to
see. (WinXP, Python 2.5, wxPython 2.8.10.1).

What I would like is a ComboCtrl that pops up a rather simple-looking
CustomTreeCtrl: items without a root, buttons, or lines, and with each
item having a checkbox. When that checkbox is checked, the item should
expand to show another item below it, which is the word "Note:" with a
textCtrl to the right of it. The idea is to allow a list of items to be
selected, but with the option to add a note to checked items.

[...]

3) I cannot type in the TextCtrl. I thought this was an issue of that I
parented it to the wrong control, but I've tried the ComboCtrl, the
popup (here, self.tcp), and the CustomTreeCtrl and only the
CustomTreeCtrl works at all--but I can't type in it/edit it.

I'm not sure about the CTC issues and don't have time to look into it myself at the moment, but this problem is likely because of the wx.PopupWindow used by the combo. I've noticed before that on Windows it has problems related to child window focus and keyboard events, and I've never understood it enough to suggest a good workaround.

My suggestion is to refactor such that your tree is a self-contained class derived from CustomTreeCtrl, and then make some test code that uses that class without it being a popup, (just parent it on a panel or something.) Then use that test code to work out all the other issues you have with it. When that is done go back to using the class as the combo popup and focus on just this issue. For example figure out for sure who has the focus and is getting the key events that should be going to the textctrl. You may have to intercept them at that window and then update the textctrl yourself.

···

On 5/12/10 5:25 PM, C M wrote:

--
Robin Dunn
Software Craftsman

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Alright, what I’m doing is simplifying it even more in that I realize I don’t really need everything a CustomTreeCtrl does–I just need a column of checkboxes with the option to expand a textCtrl under each one. I have made a simple panel that does that by binding the checkbox event and then calling .Hide() or .Show() on the textCtrl that goes with it.

But now I’m lost on how to add that to a ComboCtrl. I’m finding the documentation rather confusing; the main example I’ve found is in C++ and in other examples I’ve found sometimes it is done as a mixin and in others it isn’t.

I’m attaching what I have. If you comment in this line self.TestWidget() and comment out the line self.MakeComboPopupControl(), you can see the working control that (more or less) I want. But using it in the ComboCtrl doesn’t work; the error I have now is that I’m supplying (something) the wrong number of arguments. But I think I’m just on the wrong track anyway.

I’m muddled on how to make a custom popup in a ComboCtrl. If anyone can set me on the right path, I’d appreciate it. Sample attached.

Che

sample_checkboxes_dropdown.py (3.99 KB)

···

On Thu, May 13, 2010 at 12:18 PM, Robin Dunn robin@alldunn.com wrote:

On 5/12/10 5:25 PM, C M wrote:

Hello, list. I’m trying to create a ComboCtrl that has as its popup a

CustomTreeCtrl, and I’m having some trouble getting what I’d like to

see. (WinXP, Python 2.5, wxPython 2.8.10.1).

What I would like is a ComboCtrl that pops up a rather simple-looking

CustomTreeCtrl: items without a root, buttons, or lines, and with each

item having a checkbox. When that checkbox is checked, the item should

expand to show another item below it, which is the word “Note:” with a

textCtrl to the right of it. The idea is to allow a list of items to be

selected, but with the option to add a note to checked items.

[…]

  1. I cannot type in the TextCtrl. I thought this was an issue of that I

parented it to the wrong control, but I’ve tried the ComboCtrl, the

popup (here, self.tcp), and the CustomTreeCtrl and only the

CustomTreeCtrl works at all–but I can’t type in it/edit it.

I’m not sure about the CTC issues and don’t have time to look into it myself at the moment, but this problem is likely because of the wx.PopupWindow used by the combo. I’ve noticed before that on Windows it has problems related to child window focus and keyboard events, and I’ve never understood it enough to suggest a good workaround.

My suggestion is to refactor such that your tree is a self-contained class derived from CustomTreeCtrl, and then make some test code that uses that class without it being a popup, (just parent it on a panel or something.) Then use that test code to work out all the other issues you have with it. When that is done go back to using the class as the combo popup and focus on just this issue. For example figure out for sure who has the focus and is getting the key events that should be going to the textctrl. You may have to intercept them at that window and then update the textctrl yourself.

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

        Hello, list. I'm trying to create a ComboCtrl that has as its
        popup a
        CustomTreeCtrl, and I'm having some trouble getting what I'd like to
        see. (WinXP, Python 2.5, wxPython 2.8.10.1).

        What I would like is a ComboCtrl that pops up a rather
        simple-looking
        CustomTreeCtrl: items without a root, buttons, or lines, and
        with each
        item having a checkbox. When that checkbox is checked, the item
        should
        expand to show another item below it, which is the word "Note:"
        with a
        textCtrl to the right of it. The idea is to allow a list of
        items to be
        selected, but with the option to add a note to checked items.

    [...]

        3) I cannot type in the TextCtrl. I thought this was an issue
        of that I
        parented it to the wrong control, but I've tried the ComboCtrl, the
        popup (here, self.tcp), and the CustomTreeCtrl and only the
        CustomTreeCtrl works at all--but I can't type in it/edit it.

    I'm not sure about the CTC issues and don't have time to look into
    it myself at the moment, but this problem is likely because of the
    wx.PopupWindow used by the combo. I've noticed before that on
    Windows it has problems related to child window focus and keyboard
    events, and I've never understood it enough to suggest a good
    workaround.

    My suggestion is to refactor such that your tree is a self-contained
    class derived from CustomTreeCtrl, and then make some test code
    that uses that class without it being a popup, (just parent it on a
    panel or something.) Then use that test code to work out all the
    other issues you have with it. When that is done go back to using
    the class as the combo popup and focus on just this issue. For
    example figure out for sure who has the focus and is getting the key
    events that should be going to the textctrl. You may have to
    intercept them at that window and then update the textctrl yourself.

Alright, what I'm doing is simplifying it even more in that I realize I
don't really need everything a CustomTreeCtrl does--I just need a column
of checkboxes with the option to expand a textCtrl under each one. I
have made a simple panel that does that by binding the checkbox event
and then calling .Hide() or .Show() on the textCtrl that goes with it.

Not quite. You've got a panel that shows just one checkbox and textctrl, and manipulates it's parent to redo the layout when checked, and then you add multiples of those panels to the parent. You probably want to change things such that CheckBoxDropDown is able to manage more than one set of items by itself.

But now I'm lost on how to add that to a ComboCtrl. I'm finding the
documentation rather confusing; the main example I've found is in C++
and in other examples I've found sometimes it is done as a mixin and in
others it isn't.

Using the has-a relationship makes sense to me in this case.

class CheckBoxDropDownPopup(wx.combo.ComboPopup):
     # overridden ComboPopup methods
     def Create(self, parent):
         self.cbdd = CheckBoxDropDown(parent)

     def GetControl(self):
         return self.cbdd

     def GetStringValue(self):
         # does CheckBoxDropDown have the concept of a "current" item
         # whose value should be shown in the combo when it is selected?
         return ""

     def GetAdjustedSize(self, minWidth, prefHeight, maxHeight):
         return wx.Size(minWidth, min(200, maxHeight))

···

On 5/13/10 3:44 PM, C M wrote:

On Thu, May 13, 2010 at 12:18 PM, Robin Dunn <robin@alldunn.com > <mailto:robin@alldunn.com>> wrote:
    On 5/12/10 5:25 PM, C M wrote:

--
Robin Dunn
Software Craftsman

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

    Hello, list.  I'm trying to create a ComboCtrl that has as its

    popup a

    CustomTreeCtrl, and I'm having some trouble getting what I'd like to

    see. (WinXP, Python 2.5, wxPython 2.8.10.1).



    What I would like is a ComboCtrl that pops up a rather

    simple-looking

    CustomTreeCtrl: items without a root, buttons, or lines, and

    with each

    item having a checkbox.  When that checkbox is checked, the item

    should

    expand to show another item below it, which is the word "Note:"

    with a

    textCtrl to the right of it.  The idea is to allow a list of

    items to be

    selected, but with the option to add a note to checked items.





[...]





    3) I cannot type in the TextCtrl.  I thought this was an issue

    of that I

    parented it to the wrong control, but I've tried the ComboCtrl, the

    popup (here, self.tcp), and the CustomTreeCtrl and only the

    CustomTreeCtrl works at all--but I can't type in it/edit it.





I'm not sure about the CTC issues and don't have time to look into

it myself at the moment, but this problem is likely because of the

wx.PopupWindow used by the combo.  I've noticed before that on

Windows it has problems related to child window focus and keyboard

events, and I've never understood it enough to suggest a good

workaround.



My suggestion is to refactor such that your tree is a self-contained

class derived from  CustomTreeCtrl, and then make some test code

that uses that class without it being a popup, (just parent it on a

panel or something.)  Then use that test code to work out all the

other issues you have with it.  When that is done go back to using

the class as the combo popup and focus on just this issue.  For

example figure out for sure who has the focus and is getting the key

events that should be going to the textctrl.  You may have to

intercept them at that window and then update the textctrl yourself.

Alright, what I’m doing is simplifying it even more in that I realize I

don’t really need everything a CustomTreeCtrl does–I just need a column

of checkboxes with the option to expand a textCtrl under each one. I

have made a simple panel that does that by binding the checkbox event

and then calling .Hide() or .Show() on the textCtrl that goes with it.

Not quite. You’ve got a panel that shows just one checkbox and textctrl, and manipulates it’s parent to redo the layout when checked, and then you add multiples of those panels to the parent. You probably want to change things such that CheckBoxDropDown is able to manage more than one set of items by itself.

Is it OK that I am using a panel in creation of this custom widget? Because It thought that might be a problem for the comboctrl to pop up. I don’t need a panel, I just want a custom control that does what I want, but I’m having trouble understanding how to make it.

But now I’m lost on how to add that to a ComboCtrl. I’m finding the

documentation rather confusing; the main example I’ve found is in C++

and in other examples I’ve found sometimes it is done as a mixin and in

others it isn’t.

Using the has-a relationship makes sense to me in this case.

class CheckBoxDropDownPopup(wx.combo.ComboPopup):

# overridden ComboPopup methods

def Create(self, parent):

    self.cbdd = CheckBoxDropDown(parent)



def GetControl(self):

    return self.cbdd



def GetStringValue(self):

    # does CheckBoxDropDown have the concept of a "current" item

    # whose value should be shown in the combo when it is selected?

    return ""



def GetAdjustedSize(self, minWidth, prefHeight, maxHeight):

    return wx.Size(minWidth, min(200, maxHeight))

I’ve tried using that, and now the comboCtrl shows but when I press the button on it, the “popup” is shown below it, but not in a dropdown, and the layout is all wrong anyway. See attached.

Thanks again,
Che

sample_checkboxes_dropdown.py (4.18 KB)

···

On Sat, May 15, 2010 at 3:26 PM, Robin Dunn robin@alldunn.com wrote:

On 5/13/10 3:44 PM, C M wrote:

On Thu, May 13, 2010 at 12:18 PM, Robin Dunn <robin@alldunn.com > > mailto:robin@alldunn.com> wrote:
On 5/12/10 5:25 PM, C M wrote:

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

[quoting myself previously below]

Is it OK that I am using a panel in creation of this custom widget? Because
It thought that might be a problem for the comboctrl to pop up. I don't
need a panel, I just want a custom control that does what I want, but I'm
having trouble understanding how to make it.

Whoops, wrote too soon...see below...

I've tried using that, and now the comboCtrl shows but when I press the
button on it, the "popup" is shown *below* it, but not in a dropdown, and
the layout is all wrong anyway. See attached.

I think I was wrong here, because if I simply set the panel background
color to white and give the panel a border, it appears to look like
part of the dropdown. I assume this is the usual way to do it? In
any case, it seems fine.

So, I'm almost there. Now I just need to figure out the initial issue
of why I can't edit the textctrl within this. I'll get on that...

Che

···

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

The widget is improved and now using an ExpandoTextCtrl for the note
field, but the not-being-able-to-edit-it problem remains...

I am not sure how to proceed. I have found that if I use the Widget
Inspection Tool to watch the events, when I check a checkbox it sends
a checkbox event but no further events as I click on the textctrls.
This is despite my calling .SetFocus() on the appropriate TextCtrl in
the handler of the checkbox event. It's like it is not really there,
or that text entering of any sort (even in the comboBox itself) is
suspended when the popup is popped....

Also rather weird and probably related to this problem: if, instead
of any sort of textctrl (regular, masked, or expando), I put a
wx.Button (or other controls), then the button is put at the *top* of
the dropdown and not right under its corresponding checkbox! That
makes no sense to me at all. And, importantly, I can click on that
button (if I can see the edge of it) and that does fire a button
event. (This can be tested by commenting in the appropriate line and
commenting out the expando one.)

Thanks, and sample attached.
Che

sample_checkboxes_dropdown3.py (5.04 KB)

···

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

The widget is improved and now using an ExpandoTextCtrl for the note
field, but the not-being-able-to-edit-it problem remains...

I am not sure how to proceed. I have found that if I use the Widget
Inspection Tool to watch the events, when I check a checkbox it sends
a checkbox event but no further events as I click on the textctrls.
This is despite my calling .SetFocus() on the appropriate TextCtrl in
the handler of the checkbox event. It's like it is not really there,
or that text entering of any sort (even in the comboBox itself) is
suspended when the popup is popped....

Sorry, I don't know either. You may want to search in Trac to see if there have been bug reports about this (I'm fairly sure there have been, maybe not about comboctrls specifically but at least about keyboard interaction with items on popup windows) and see what the comments say about it. Maybe there is a hint there.

Also rather weird and probably related to this problem: if, instead
of any sort of textctrl (regular, masked, or expando), I put a
wx.Button (or other controls), then the button is put at the *top* of
the dropdown and not right under its corresponding checkbox! That
makes no sense to me at all. And, importantly, I can click on that
button (if I can see the edge of it) and that does fire a button
event. (This can be tested by commenting in the appropriate line and
commenting out the expando one.)

It's because of an exception causing the layout steps to be skipped:

Traceback (most recent call last):
   File "h:\Desktop\sample_checkboxes_dropdown3.py", line 56, in OnCheck
     note.SetSelection(-1,-1)
AttributeError: 'Button' object has no attribute 'SetSelection'

···

On 5/16/10 12:12 AM, C M wrote:

--
Robin Dunn
Software Craftsman

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Sorry, I don't know either. You may want to search in Trac to see if there
have been bug reports about this (I'm fairly sure there have been, maybe not
about comboctrls specifically but at least about keyboard interaction with
items on popup windows) and see what the comments say about it. Maybe there
is a hint there.

I looked and indeed a hint was there, in that here
(wxTrac has been migrated to GitHub Issues - wxWidgets) it mentioned a problem with
focusing the child widgets. Which led me to this comment in the Trac
discussion: "Did you try calling wxComboCtrl::UseAltPopupWindow()?
This function has been added specifically for this sort of situation
where ability to focus a popup child is critical." Hmmm...

So I tried calling that--self.ComboCtrl.UseAltPopupWindow()--and, on
Windows at least, it works! Which is great news.

Then I tried it on Linux, where it wasn't having the problem in the
first place, and the presence of that line causes the popup not to pop
up at all. So I just did a check of the OS and only if it is Windows
I call the line, no problem. (I have no idea what the situation is on
Mac, as I don't own one).

Now there are just two issues left with this widget...

1) On WinXP: if I use ExpandoTextCtrl (which I think is most
appropriate), the scrolling of the window is hobbled: if you check a
checkbox, you will have the focus on the ExpandoTextCtrl but if you
try to scroll with the mouse wheel it won't scroll. The only way to
return control of scrolling to the mouse wheel is to uncheck a
checkbox. But, if I use a regular TextCtrl, the mouse wheel retains
control of scrolling throughout. I do think the Expando is really
nice here (since it neatly allows the note to be as many lines as is
needed), so is there a way to fix this? Any idea why the Expando is
stealing mouse wheel scrolling?

2) On Linux (Ubuntu Intrepid): There is no cursor (caret) in either
the ExpandoTextCtrl or a regular wxTextCtrl. The caret is there when
the widget is just on a panel but not when the widget is in the
ComboCtrl. Interestingly, I tried calling .ShowNativeCursor() on the
textCtrls and on Windows that passed without error but on Linux it
said there is no such method. Is there any way to force Linux to show
the caret when it's in the ComboCtrl?

Thanks again very much. Sample attached.
Che

sample_checkboxes_dropdown4.py (5.42 KB)

···

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

The only way to return control of scrolling to the mouse wheel is to uncheck a checkbox.

I think I have an acceptable halfway solution for this issue. I bind
an EVT_LEFT_UP event on the main panel, so that now if the user is
done editing the ExpandoTextCtrl he/she can click on the panel (the
background of the popup) and it returns focus to the checkbox that is
associated with the textCtrl that was just edited. This at least
allows scrolling to be easy to activate on the mouse wheel by just
clicking outside the textCtrl.

I also noticed that if I press tab, I the mouse wheel regains control
of scrolling.

I still think Linux's way of doing it (where the mouse wheel always
retains scrolling,even while the textCtrl retains focus) is best, and
if that can be accomplished on Windows, great. But if not, this isn't
too bad.

Che

···

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Yeah, this is a native behavior issue. Windows will only send wheel events to the widget with the focus. The other platforms will send them to the widget under the mouse cursor whether it has the focus or not.

···

On 5/17/10 3:49 PM, C M wrote:

The only way to return control of scrolling to the mouse wheel is to uncheck a checkbox.

I think I have an acceptable halfway solution for this issue. I bind
an EVT_LEFT_UP event on the main panel, so that now if the user is
done editing the ExpandoTextCtrl he/she can click on the panel (the
background of the popup) and it returns focus to the checkbox that is
associated with the textCtrl that was just edited. This at least
allows scrolling to be easy to activate on the mouse wheel by just
clicking outside the textCtrl.

I also noticed that if I press tab, I the mouse wheel regains control
of scrolling.

I still think Linux's way of doing it (where the mouse wheel always
retains scrolling,even while the textCtrl retains focus) is best, and
if that can be accomplished on Windows, great. But if not, this isn't
too bad.

--
Robin Dunn
Software Craftsman

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Thanks, good to know.

Any thoughts on the other problem, that Linux loses the caret when
textCtrls are within a popup? Thanks,

Che

···

On Tue, May 18, 2010 at 5:30 PM, Robin Dunn <robin@alldunn.com> wrote:

On 5/17/10 3:49 PM, C M wrote:

The only way to return control of scrolling to the mouse wheel is to
uncheck a checkbox.

I think I have an acceptable halfway solution for this issue. I bind
an EVT_LEFT_UP event on the main panel, so that now if the user is
done editing the ExpandoTextCtrl he/she can click on the panel (the
background of the popup) and it returns focus to the checkbox that is
associated with the textCtrl that was just edited. This at least
allows scrolling to be easy to activate on the mouse wheel by just
clicking outside the textCtrl.

I also noticed that if I press tab, I the mouse wheel regains control
of scrolling.

I still think Linux's way of doing it (where the mouse wheel always
retains scrolling,even while the textCtrl retains focus) is best, and
if that can be accomplished on Windows, great. But if not, this isn't
too bad.

Yeah, this is a native behavior issue. Windows will only send wheel events
to the widget with the focus. The other platforms will send them to the
widget under the mouse cursor whether it has the focus or not.

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Sorry, no I don't have any ideas about that.

···

On 5/18/10 4:08 PM, C M wrote:

On Tue, May 18, 2010 at 5:30 PM, Robin Dunn<robin@alldunn.com> wrote:

On 5/17/10 3:49 PM, C M wrote:

The only way to return control of scrolling to the mouse wheel is to
uncheck a checkbox.

I think I have an acceptable halfway solution for this issue. I bind
an EVT_LEFT_UP event on the main panel, so that now if the user is
done editing the ExpandoTextCtrl he/she can click on the panel (the
background of the popup) and it returns focus to the checkbox that is
associated with the textCtrl that was just edited. This at least
allows scrolling to be easy to activate on the mouse wheel by just
clicking outside the textCtrl.

I also noticed that if I press tab, I the mouse wheel regains control
of scrolling.

I still think Linux's way of doing it (where the mouse wheel always
retains scrolling,even while the textCtrl retains focus) is best, and
if that can be accomplished on Windows, great. But if not, this isn't
too bad.

Yeah, this is a native behavior issue. Windows will only send wheel events
to the widget with the focus. The other platforms will send them to the
widget under the mouse cursor whether it has the focus or not.

Thanks, good to know.

Any thoughts on the other problem, that Linux loses the caret when
textCtrls are within a popup?

--
Robin Dunn
Software Craftsman

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

I'm setting the issue of no caret in Linux aside for now; maybe that
can be lived with.

But I picked up this widget again now and am hoping to finish it out
and maybe it could be useful for wxPython (I'd also like to break it
into just the native checkbox list w/ or w/o notes and then the same
thing under a popup). But there are a few more small points.

Any help appreciated on:

1) I would like a way to have the idea that the items in the checkbox
list can either have notes (associated with each checkable item) or
not have notes. I'd want to pass a flag upon calling the widget (like
notes='off''), but I can't figure out how to modify what I have to
pass in that argument when I call the popup and have it get up to the
CheckBoxDropDown class and tell it to not bother with the notes part
of it.

2) Another minor point is why, after I am done using it, and I go to
shut the frame, if I've clicked in a notes region, I have to click the
red close X on the frame 2-3x. I think this is because the widget
still has the mouse focus. What would be the best way to get around
that? I tried to use EVT_LEAVE_WINDOW to set the focus to the frame,
but that is not good since just accidentally going outside of the
dropdown closes it, and that's bad UI.

I'll also have to think more about what should be displayed in the
textCtrl at the top, since here (answering Robin's question) there is
no concept of a "current" item whose value should be shown in the
combo when it is selected. It might be start with "Choose selections"
and end with "Selections chosen" or something like that.

Minimal runnable sample attached.

Thanks,
Che

sample_checkboxes_dropdown5.py (5.8 KB)

···

On Tue, May 18, 2010 at 11:30 PM, Robin Dunn <robin@alldunn.com> wrote:

On 5/18/10 4:08 PM, C M wrote:

On Tue, May 18, 2010 at 5:30 PM, Robin Dunn<robin@alldunn.com> wrote:

On 5/17/10 3:49 PM, C M wrote:

The only way to return control of scrolling to the mouse wheel is to
uncheck a checkbox.

I think I have an acceptable halfway solution for this issue. I bind
an EVT_LEFT_UP event on the main panel, so that now if the user is
done editing the ExpandoTextCtrl he/she can click on the panel (the
background of the popup) and it returns focus to the checkbox that is
associated with the textCtrl that was just edited. This at least
allows scrolling to be easy to activate on the mouse wheel by just
clicking outside the textCtrl.

I also noticed that if I press tab, I the mouse wheel regains control
of scrolling.

I still think Linux's way of doing it (where the mouse wheel always
retains scrolling,even while the textCtrl retains focus) is best, and
if that can be accomplished on Windows, great. But if not, this isn't
too bad.

Yeah, this is a native behavior issue. Windows will only send wheel
events
to the widget with the focus. The other platforms will send them to the
widget under the mouse cursor whether it has the focus or not.

Thanks, good to know.

Any thoughts on the other problem, that Linux loses the caret when
textCtrls are within a popup?

Sorry, no I don't have any ideas about that.

--
Robin Dunn
Software Craftsman
http://wxPython.org