wx.MDIChildFrame = tabbed window (Linux)? / design problems

Robin Dunn wrote:

Correct. MDI is a Microsoft invention that nearly everyone else
wisely chose to not copy.

(I know a big control control technology manufacturer who did, and
I'm trying to simulate his product :wink: )

So wxWidgets simulates it on wxGTK with a wx.Notebook instead. (I
once used a GUI toolkit that tried to fully emulate MDI on
X-Windows systems. It was about the crappiest UI thing I've ever
seen.)

OK, thanks for the warning.

You'd probably be better off to just either use multiple single
document windows (IOW, multiple top level frames) or a single main
window with floating "tool" windows depending on your needs. Even
Microsoft uses this interface now and doesn't use MDI any more.

Okay, that seems to me now to be the best way, too. I'd like to have
one autosizing tool window that adapts to its parent, see below ...

- An empty wx.Panel parented to a wx.Frame always seems to have
(0,0) as size. Normal? I'd just like to have a coordinate system
local to the Frame, excluding the menu bar (so an object at local
(0,0) is directly at the menu bar's low border).

That's normal if you don't do anything to cause the panel be sized
to fill its alloted space. Either make it be the only child of
the frame, or put it in a sizer with the other frame children.

Strange, it _is_ the only child ... (Or am I getting something
wrong?)

mainWindowSize = (1024,768)

mainWindowStyle = (wx.DEFAULT_FRAME_STYLE
                    ^wx.MAXIMIZE_BOX
                    ^wx.MINIMIZE_BOX
                    ^wx.CLOSE_BOX
                    ^wx.RESIZE_BORDER)
# ...
class MainFrame(wx.Frame):
    def __init__(self, parent, id, pos):
        wx.Frame.__init__(self,
                          parent,
                          id,
                          "Main Menu",
                          size = mainWindowSize,
                          style = mainWindowStyle,
                          pos=pos)

        self.panel = panel = wx.Panel(self, -1)
        print self.GetSize(), panel.GetSize()
        panel.SetBackgroundColour("Black")
        self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
        self.createMenuBar()

    # ...

The above "print" gives (1024,768) (20,20), but the frame background
is all black.

If I add a sizer

        # ...
        panel.SetBackgroundColour("Black")
        panelSizer = wx.BoxSizer()
        panelSizer.Add(self.panel)
        self.SetSizer(panelSizer)
        panelSizer.Layout()
        # ...

the black frame background shrinks to a ... (20,20) square. An
identical print statement like above gives the same (namely,
1024x768) (20,20)).

Also, how can I get window-local coordinates? I'd like to get the
(0,0) in self.panel's coordinates as screen coordinates.

If I insert, in the above __init__, the following

print self.ClientToScreenXY(0,0)

it yields (0,0). But my window is not positioned in a way that the
panel's (0,0) is in the upper left hand corner of the screen :frowning: Is
my approach wrong?

Make the column be as wide as the listctrl minus the horizontal
size of the vertical scrollbar. There is the
wx.lib.mixins.listctrl.ListCtrlAutoWidthMixin class to help with
this if you want to use it.

Works great! :slight_smile: Thanks. I had already looked at a demo file where it
was used, but had totally overlooked it.

Best Regards,

Björn

···

--
BOFH excuse #249:

Unfortunately we have run out of bits/bytes/whatever. Don't worry,
the next supply will be coming next week.