Big problem.
I'm programming a tile editor for one of my games. Here is my setup.
I've got a tile window docked to the main frame window and I've written specialized code to handle drawing, selecting, scrolling, etc, for the tiles. I want this to be docked so I derived it from CDialogBar so I could get docking functionality.
Here is the problem. CDialogBar can only be created inside of CFrameWnd::OnCreate so the CDialogBar derived class which I call CTileDlgBar can only be used inside of the CFrameWnd derived class - CMainFrame.
CMainFrame=CFrameWnd object
CTileDlgBar=CDialogBar object
Ok but I also need to know the tilesize being used in my app so I can correctly draw the tiles in the larger view window which resides in the main frame.
My system does not extract tiles from large bitmaps. Rather the entire bitmap is loaded and you select a cursor or 'grabber' size rectangle and when you click the LMB on a bitmap in the TileDlgBar, it automatically extracts the bitmap that resides in the chosen rectangle.
Now when you click in the view window, I want the bitmap that was selected in the docked dialog window to appear in the view.
Here is the problem. How the heck can I pass the bitmap from the dialog window class to the view window class? If you know how the document/view architecture works you will understand that just creating a function to pass a pointer to the CView class doesn't work. Since the dialog class is a member of the frame window class and the frame window doesn't know anything about the view - or at least every time I call GetActiveView() it returns a NULL pointer......I can't pass any information between them.
I was going to use this:
CMapView *map=(CMapView *)GetActiveView();
map->SetTileWindowPtr(m_TileDlgBar);
Then the view would have a pointer to the dialog bar class and everything works great. But every frieking time I do this, the pointer returned is NULL as if there is no active view.
How can I use this cool dialog bar I coded given the major restraints inherent in the doc/view architecture? According to MS, my document should hold the data - so are they saying that my dialog should report back to the document class? It's not possible. The dialog bar cannot be in the document class...there is no way to create it and attach it to the frame window.
I'll include a screenshot so you guys can see what's going on.