|
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.
|
|
|
|
|
Hello,
how can insert in a child of SplitterWnd a CPropertySheet?
I know that the CPropertySheet is'nt a CView deriviates.
But is there any way, which I can include CPropertySheet ?
Thanks for any helps. jr
|
|
|
|
|
you might be better posting this in the main forums
however I suspect the best way would be to simulate a property sheet by using a form view and a tab control and then switch between your little dialogs
Technically speaking the dictionary would define Visual Basic users as programmers. But here again, a very generalized, liberal definition is being employed and it's wrong - just plain wrong - Tom Archer 5/12/02
|
|
|
|
|
I have a mainframe class which switches among many form views. In one of the Form view i have to crate static splitter wnd with 1 row and 2 cols.
How to do this?
|
|
|
|
|
Have you looked at the sample project?
Here is the relevant area from MainFrm.cpp.
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if (!m_wndSplitter.CreateStatic(this,1,2))
{
TRACE(_T("failed to create the splitter"));
return FALSE;
}
if (!m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CSplittstView),CSize(100,100),pContext))
{
TRACE(_T("Failed to create view in first pane"));
return FALSE;
}
if (!m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CForm1),CSize(100,100),pContext))
{
TRACE(_T("failed to create view in second pane"));
return FALSE;
}
return TRUE;
}
However this sort of question should be sent to the MFC forum and not to an articles questions.
Technically speaking the dictionary would define Visual Basic users as programmers. But here again, a very generalized, liberal definition is being employed and it's wrong - just plain wrong - Tom Archer 5/12/02
|
|
|
|
|
HI,
How can I use the CUsefulSplitterWnd for MDI ?
The example is a SDI-App.
Must I move the OnCreateClient in CFrame to CChildFrame ?
Have someone an example ? Thanks.
|
|
|
|
|
you use the CUsefulSplitterWnd in an MDI app in the same way as you would CSplitterWnd - so yes you would move it to CChildFrame - have you tried?
Technically speaking the dictionary would define Visual Basic users as programmers. But here again, a very generalized, liberal definition is being employed and it's wrong - just plain wrong - Tom Archer 5/12/02
|
|
|
|
|
Hello,
yes I tried it. At program start is working fine.
But if I try to schwitch/change to other CFormView,
I have problems with ReplaceView(..) Function .
CChildFrame*pChildFrame=(CChildFrame*)AfxGetMainWnd();
pChildFrame->m_wndSplitter.ReplaceView(0,1,RUNTIME_CLASSCForm1),CSize(100,100));
So, in Function I have an exception.
It's came from the GetPane() ?
<<if ((getpane(row,col)-="">IsKindOf(pViewClass))==TRUE)>>
It's seem that I have not a correct pointer of the View?
Have you the same example as MDI example ? I would be nice to have it here as downloadable.
Greetings, jr
|
|
|
|
|
Ah - the AfxGetMainWnd would be wrong as it would be pointing at the wrong window - do you have a sample at all - I'll try and find a compiler to run it on (away from my development machine for a few weeks)
Technically speaking the dictionary would define Visual Basic users as programmers. But here again, a very generalized, liberal definition is being employed and it's wrong - just plain wrong - Tom Archer 5/12/02
|
|
|
|
|
Hello Shoun,
thanks for all helps. I solve the problem. You're on right
with the pointer from the wrong window in MDI -Application.
//ReplaceView in SDI-Application :
CMainFrame *pMainFrame=(CMainFrame*)AfxGetMainWnd();
pMainFrame->m_wndSplitter.ReplaceView(0,1,RUNTIME_CLASS(CForm1),CSize(100,100));
//ReplaceView in MDI-Application:
CMDIFrameWnd* pMainWnd = (CMDIFrameWnd*)AfxGetMainWnd();
// Get the active MDI child window.
CChildFrame* pChild = (CChildFrame*)pMainWnd->MDIGetActive();
pChild->m_wndSplitter.ReplaceView(0,1,RUNTIME_CLASS(CForm1),CSize(100,100));
Send Greetings to your family from the Black Forest /Heidelberg. jr
|
|
|
|
|
With this method, you can't get a pointer to the Document Class, you'll become an ASSERT Error.
CMyDocClass*pDoc = GetDocument();
Try it....
Update: I've found the Problem *rofl* its awkward, i've forgot to implement your method in the children window...
Greetz Neti from Switzerland ^_^
If you, your girlfriend and dead people are in the room means that all are deaf. How many people are there?
|
|
|
|
|
Hi
First of all congratulations, great work.
I use your class and I have a little problem. I try to discribe it: I want to print the right view. On the left view I ve to click for changing the view on the right side, the focus is on the left splitter and when I click directly on printing. What happens: the printing message goes to the left splitter not to the right one.
When I click into the right splitter and than on printing it works.
My question is what must I do to set the focus automatically on the right splitter. I want to do it always.
I hope you understand what I want. Perhaps it is easy to solve and you can help me
thanks
yummi
|
|
|
|
|
I think its all related to how MFC does its printing - I think by default it will print the first view in its list of views - what you have to do is override this default mechanism and make it print the second view instead - I think there is a command message you can intercept ID_FILE_PRINT that may help you
Technically speaking the dictionary would define Visual Basic users as programmers. But here again, a very generalized, liberal definition is being employed and it's wrong - just plain wrong - Tom Archer 5/12/02
|
|
|
|
|
Hi
First of all thank you for your answer.
I noticed the following: when I don't click on the second pane (view) and I changed the view by clicking on another item in the first pane the algorithm set always the new view as active.
When I click in the view pane and after I do this I click in the first pane to change the view, the ActivateView function will not be called, because of that the printing message receives in the first pane (the selecting area).
I make the following changes in the function ReplaceView:
<br />
if (pActiveView==NULL || pActiveView==GetPane(row,col))<br />
bSetActive=TRUE;<br />
else<br />
bSetActive=TRUE;
so that bSetActive always be TRUE (I show it on that way so that you can find it on your code)
Because of that here
<br />
if (bSetActive==TRUE)<br />
GetParentFrame()->SetActiveView(pNewView); <br />
the new View always get the active part.
I don't know if there is any secondary effect on your algorithm?
I Hope you understood whatv I mean.
Thanks
yummi
|
|
|
|
|
This class clarified a lot for me and made my life a little happier today; thanks a bunch!!! Great work.
|
|
|
|