I have an application where a wxPanel contains several other wxPanels.
These child-panels have several buttons and use wxTAB_TRAVERSAL.
Each of those child-panels "remembers" the most recently used button
and draws a thin black border around it. IMHO this behaviour is rather
ugly, so I decided to look for a workaround.
Someone on the wxwindows list suggested to derive from wxButton,
to add handlers with EVT_KILL_FOCUS and EVT_COMMAND and to
call panel.SetDefaultItem(NULL) in those handlers.
But in wxPython SetDefaultItem(None) seems to have the opposite effect:
The panel forgets to remove the black border from the "old" control and
sooner or later all buttons seem to be the "default".
Neither did panel.SetDefaultItem(a_hidden_button) help.
And yes, I called event.Skip()
Is it possible to reset the default-item properly?
Or is there a way to avoid those default-buttons in the first place?
But in wxPython SetDefaultItem(None) seems to have the opposite effect:
The panel forgets to remove the black border from the "old" control and
sooner or later all buttons seem to be the "default".
Neither did panel.SetDefaultItem(a_hidden_button) help.
And yes, I called event.Skip()
Is it possible to reset the default-item properly?
How about a_hidden_button.SetDefault()?
Or is there a way to avoid those default-buttons in the first place?
Not that I know of.
···
--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters? http://wxPython.org Relax with wxPython!
When selecting that notetab, sometimes the colour is there and sometimes the
tab just flickers and remains grey. Is there anything I can do to fix this?
The tab will change colour if one resizes the window.
I had a similar problem changing button colours on the fly, but was able to
'fix' it by issuing a wxWindowDisabler(), which otherwise seems to do
nothing. I know it makes no sense, but it works.
On a somewhat related note, I am able to set foreground and background
colours by row in a wxListCtrl, but not by column. There is no error, but
nothing happens.
When selecting that notetab, sometimes the colour is there and sometimes
the
tab just flickers and remains grey. Is there anything I can do to fix
this?
Yep, put a wxPanel under the wxScrolledWindow. It's weird but it works.
There's some interaction between the notebook and the scrolled window that
we havn't been able to figure out yet.
You'll need to use a sizer or something to keep the scrolled window the same
size as the panel. There is a bit in the demo that does this for the main
demo frame. Search for "bug #216861" in wxPython/demo/Main.py
On a somewhat related note, I am able to set foreground and background
colours by row in a wxListCtrl, but not by column. There is no error, but
nothing happens.
In the wxListCtrl in REPORT mode the entire row is considered a single item,
and is the level of granularity for style settings.
···
--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters? http://wxPython.org Relax with wxPython!
> win.form = wxScrolledWindow(win.nb, -1)
> form = win.nb.AddPage(win.form, "Form")
> win.form.SetBackgroundColour(wxColour(83, 139, 139) )
>
> When selecting that notetab, sometimes the colour is there and sometimes
Yep, put a wxPanel under the wxScrolledWindow. It's weird but it works.
There's some interaction between the notebook and the scrolled window that
we havn't been able to figure out yet.
Thanks very much, I'll do that. It's got to be better than
x, y = self.GetClientSizeTuple()
foo = (x + 1, y + 1)
bar = (x, y)
self.SetClientSize(foo)
self.SetClientSize(bar)
which works, but flickers of course.
You'll need to use a sizer or something to keep the scrolled window the
same size as the panel. There is a bit in the demo that does this for the
main demo frame. Search for "bug #216861" in wxPython/demo/Main.py
Thank you. This might fix something else too. Adding items into a sizer on
that tab don't provoke a scroll bar. Dunno why.
In the wxListCtrl in REPORT mode the entire row is considered a single
item, and is the level of granularity for style settings.
wxGrid then is the way to go for that sort of thing. I thought some of the
function names /implied/ that they would return a 'cell'. This info saves me
from further experimenting there.
Thanks for replying so quickly - and thanks for a really nice lib to play
with! ESR's right: it should be shipped standard.
> > win.form = wxScrolledWindow(win.nb, -1)
> > form = win.nb.AddPage(win.form, "Form")
> > win.form.SetBackgroundColour(wxColour(83, 139, 139) )
> >
> > When selecting that notetab, sometimes the colour is there and sometimes
I use a scrolled window as direct notebook child, but in my app.
before adding the page the scrolled window has all its control-children
in it.
I've made the experience that a notebook-page which contents
is changed (added/deleted control-children) has to be selected
( SetSelection( pagenr ) ) even if it is not the page which one wants to
show,
after that I set the previous selection. Without doing that the changed
page
remains gray. (Py2.0/wxPy2.2.2/MSW98)