|
Tell everybody a good news!
I've resolved that problem.
At last,I creat Dialoges in dll with hParent which is passed from the exe(main window) as the parent window's handle.
And in that process,I must use MFC regular Dll, remember to add __stdcall before every function's declaration,include the typedefine of the function pointer(I call the Dll in obvious way(use LoadLibrary)).
Then you could set the style of the dialog in dll as "Child" and the border as "No border".
That's all. By the method I gived above,I can also create the dialogWindow like FormWindow in any CView class.Include CListView,CTreeView,CFormView and all those classes inherit from CView!
I think this is another way to reach the same result as the CUsefulSplitterWnd written by Mr Shaun,(am I right Mr Shaun?)
Here today,I must thank to Mr Shaun for his idea.You're the pioneer,you give me directions.
Thank you Mr Shaun!
PS: What's the meaning of Shaun?I wanna know.
Could you please sent me E-mail if you don't care about it?
hfhero@msn.com
|
|
|
|
|
Hi William (Hero)
Glad you solved you problem.
Shaun is a derviation of the name John. Name meanings can be found on the web see Baby Names[^] - I quite like it.
I'll be more enthusiastic about encouraging thinking outside the box when there's evidence of any thinking going on inside it. - pTerrywww.many-monkeys.com
|
|
|
|
|
hello.
Thanks for your greate work.
I attated several CFormView on the splitted window.
It works very fine.( ex) Formview A : contain 'CEditBox', Formview B : contain 'CEditBox' )
Your replaceView destroy each view and create new one every time.
Is there any good way not to destroy each view??
It's very painful to re-draw all information of each view again.
hugman
|
|
|
|
|
You can always try dettaching the views and attaching your own views and then keep the old view for later.
There are 10 sorts of people in this world. Those who understand binary and those that don't.www.many-monkeys.com
|
|
|
|
|
Could you explain how to detatch and attach views withgout destroying?
I'm novice user of MFC.
Thank you .
|
|
|
|
|
Even though this thread is getting on the old side I figured I'd post my solution to this problem for all the google-ites out there. Setting a CSplitterWnd view without creating a new one is suprisingly easy. Despite this, I couldn't find anything on the subject after an hour of searching.
Here's the method I added to my derived splitter class:
void CSplitterWndEx::SetPaneView( int iRowIndex, int iColIndex, CSize sizeInit, CWnd *pView )
{
pView->SetDlgCtrlID( IdFromRowCol( iRowIndex, iColIndex ) );
pView->SetParent( this );
pView->SetWindowPos( NULL, 0, 0, sizeInit.cx, sizeInit.cy, SWP_NOZORDER );
m_pColInfo[iColIndex].nIdealSize = sizeInit.cx;
m_pRowInfo[iRowIndex].nIdealSize = sizeInit.cy;
}
So far everything works swimmingly. Any additional stuff would entirely depend on your application.
-- modified at 17:36 Friday 26th May, 2006
|
|
|
|
|
thankx - sorry I didn't get round to this one myself
I'll be more enthusiastic about encouraging thinking outside the box when there's evidence of any thinking going on inside it. - pTerrywww.many-monkeys.com
|
|
|
|
|
Excellent class however I want to use precreated view and not destroy them on a view switch. Unfortunately I cannot understand how to integrate the suggestion from ZeugmaBarter into the class.
The SetPaneView() member takes a CWnd presumably of a CView which was created dynamically. However how does that square with the need to use CreateView() in the main frame, this call taking a CRuntimeClass pointer. I assume that this call goes off and creates the CFormView to be displayed?
Apologies if this sound dumb but SDI and MDI applications are not my strong point, I mostly manage to get away with Dialogs, hence I do not quite understand the view and doc creation involved in the SDI/MDI process.
Ideally I would prefer to use a CDialog with a splitter.
Cheers
|
|
|
|
|
bilsby wrote: Excellent class however I want to use precreated view and not destroy them on a view switch. Unfortunately I cannot understand how to integrate the suggestion from ZeugmaBarter into the class.
Add the method to the class. Instantiate your views and then use the class to switch between them based on some event. e.g. menu?
bilsby wrote: Ideally I would prefer to use a CDialog with a splitter.
CFormView is/was the view equivalent of a dialog - cut and paste your code.
PS. I haven't used MFC for many years so apologies if my MFC knowledge is out of date
I'll be more enthusiastic about encouraging thinking outside the box when there's evidence of any thinking going on inside it. - pTerrywww.many-monkeys.com
|
|
|
|
|
Thanks for this, very helpful for me.
It does not matter that its kind of old, some of us make a good living out of maintaining\enhancing existing applications
There are many old bridges dotted around towns and cities but we dont rebuild them all with modern materials simply because we can.
I dont know why it is so many people fail to grasp this with software but can with everything else.
PR Marjoram BSc
|
|
|
|
|
In the ReplaceView() method there is a little bug. If you use CWnd derived class instead of CView, the call :
if(bSetActive==TRUE)
GetParentFrame()->SetActiveView(pNewView);
will fail, you have just to comment this part of code
If you need to call DoDataExchange of your CFormView derived class, for example if you have Custom Controls inside your dialog that need to be initialized by DDX, youd need to add a call to the UpdateData method.
if (bSetActive==TRUE)
GetParentFrame()->SetActiveView(pNewView);
GetPane(row,col)->UpdateData(FALSE);
RecalcLayout();
GetPane(row,col)->SendMessage(WM_PAINT);
That's all. And many thanks to the author of this very usefull class.
Why trying to create the wheel if your roommate just invented the car (Me)
|
|
|
|
|
Awesome little trick.
|
|
|
|
|
Hi,
I've got an SDI app with a splitter, but as soon as I override OnCreateClient in CMainFrame (returning TRUE instead of CFrameWnd::OnCreateClient(...)) I completely lose printing support. I see that CFrameWnd::OnCreateClient creates a view which I guess I need to enable printing support.
Any ideas on how I can get round this cos I wanted to have my app print a custom report, but I don't get "free printing" now!
Thanks in advance
Life would be a lot easier if I had the source code...
|
|
|
|
|
Are you trying to print from all 3 views at one and make it look like one print out? - if so I am not sure that MFC can cope with that.
The other is to custom print and ignore the views completely and print directly to the printer DC - a bit more hard work but in the end more controllable - ie paging etc
I am using VB on the current project
www.many-monkeys.com
|
|
|
|
|
I was after doing custom printing (which I've done before) but by hijacking the print preview button. But once OnCreateClient is overridden, any button or menu option with the ID_FILE_PRINT_PREVIEW identifier is automatically disabled by default.
Could I give a different button/menu option print preview capabilities? If so, how do I call a print preview myself without relying on the framework to do it for me?
Sorry for the n00bish questions!
Thanks for your help
Life would be a lot easier if I had the source code...
|
|
|
|
|
Sorry - can't help you on this as I don't know.
You could look into what MFC does when it disables the button - you should have the Source code installed when you installed Visual Studio. and then undo its changes. I think however that Print Preview can only cope with 1 View rather than the mulitple views that a splitter introduces.
Your best bet would be to look through the MFC printing articles on CodeProject or other programmer sites and or post your question on the foruns and/or newsgroups.
Shaun
I am using VB on the current project
www.many-monkeys.com
|
|
|
|
|
Ok, I thought I was starting treading out of the bounds of this thread!
Thanks for your help anyway & cheers for the splitter class (helped me a lot)
Life would be a lot easier if I had the source code...
|
|
|
|
|
Hi,
Is there a way to hide the split bar itself so you wont notice that it is a split window at all??
Thanks!
|
|
|
|
|
I haven't tried - however you might be able to try an ownerdraw approach
I am using VB on the current project
www.many-monkeys.com
|
|
|
|
|
Did you ever find a solution to this ? and if so will you share?
I'm attempting the same thing and can't seem to find any useful information
Thanks in advance
qcha0s
|
|
|
|
|
Have you tried the owner draw technique?
There are 10 sorts of people in this world. Those who understand binary and those that don't.www.many-monkeys.com
|
|
|
|
|
Actually... I found an interesting blurb about creating a class and inheriting from CSplitterWnd and overloading two of the un-documented methods to set the width of the splitter, and remove the re-sizing grabber...
The original article I used is Here[^] but I guess it was a little dated, because there was no CPaneSplitter() method in the AFXEXT.H file when I looked (after getting no results) ... so, I used DrawAllSplitBars in place, and added in the additional members that the other article was missing ...
Here is what I did (works great!)
// - .H File - //
class CThinFrameSplitterWnd : public CSplitterWnd {
public:
void DrawAllSplitBars(CDC* pDC, int cxInside, int cyInside);
int HitTest(CPoint pt) const;
};
// .CPP File - //
void CThinFrameSplitterWnd::DrawAllSplitBars(CDC* /*pDC*/, int /*cxInside*/, int /*cyInside*/){
m_cxSplitter = 0;
m_cySplitter = 1;
m_cxBorderShare = 0;
m_cyBorderShare = 0;
m_cxSplitterGap = 0;
m_cySplitterGap = 0;
m_cxBorder = 0;
m_cyBorder = 0;
}
int CThinFrameSplitterWnd::HitTest(CPoint /*pt*/) const {
ASSERT_VALID (this);
return 0; // don't let the user see the mouse hits
}
Then i just swapped
CSplitterWnd m_mainSplitter;
for
CThinFrameSplitterWnd m_mainSplitter;
and poof! ... no more splitter bar (which was exactly what I wanted)
I hope this little tid bit helps out others as well as it has me
qcha0s
|
|
|
|
|
Thanks
- must admit I haven't written any MFC in 3 years - brought back some memories
There are 10 sorts of people in this world. Those who understand binary and those that don't.www.many-monkeys.com
|
|
|
|
|
memories? or nightmares :P
qcha0s
|
|
|
|
|
Your piece of code to lock the splitter bar helped me a lot! Thanks so much.
|
|
|
|