|
Hello,
I have a child window in my application but when I maximize the window the child window doesn't get merged with the main window.
Pritha
|
|
|
|
|
You mean the child window is not getting resized?
|
|
|
|
|
Hello,
The child window is getting resized but when I press the maximize button of the child window , the whole of child window is seen without the main window having the restore button.The child window is now seen as the main window without the restore button.
Prithaa
|
|
|
|
|
Could please show me the code part of child creation and maximize handling?
|
|
|
|
|
hello,
The TableFrame's CreateFrame() is creating the Child Window and when the maximize is pressed the OnSize() is called.
TableFrame::CreateFrame()
{
if(!CMDIChildWnd::Create(NULL, FrameName , WS_VISIBLE | WS_CHILD |
WS_BORDER |WS_MAXIMIZEBOX | WS_MINIMIZEBOX |
WS_THICKFRAME | WS_OVERLAPPEDWINDOW
|WS_VSCROLL | WS_HSCROLL ,
WindowSize(), pFrame, NULL))
{
TRACE0("Failed to create view window\n");
return false;
}
}
void TableFrame::OnSize(int nType)
{
switch(nType)
{
case SIZE_MAXIMIZED :
{
CRect ParentRect;
MDIMaximize();
break;
}
}
}
|
|
|
|
|
Is TableFrame derived from CMDIChildWnd?
|
|
|
|
|
hello,
thanks for your replies.
yes TableFrame is derived from CMDIChildWnd
Prithaa
|
|
|
|
|
Why are you calling MDIMaximize() from OnSize?
I just tried it in a sample application. But could not find any problem... If you can please mail me the source. It is ns.nest@gmail.com
|
|
|
|
|
Hello,
I am using MDIMaximize() to maximize the child window. I ll try to post the code.
Thanks,
Prithaa
|
|
|
|
|
I shall check the code... may be a little bit later...
|
|
|
|
|
Problem can be solved by calling CMDIChildWnd::OnSize in TableFrame::OnSize.
|
|
|
|
|
Hello,
Thanks ,
Now I am getting the minimize,restore,close buttons for the child window and minimize,maximize,close buttons for the main window but it looks like the minimize,restore,close buttons for the child window does not have a handler function
but the main window's button handler is the TableFrame's OnSize().
Pritha
|
|
|
|
|
Ya... I found that but didn't get enough time to resolve that...
prithaa wrote: but the main window's button handler is the TableFrame's OnSize().
I didn't understand...
|
|
|
|
|
Thanks for all the help
If you happen to find out the problem then please let me know
my address
priyakalashi@yahoo.com
|
|
|
|
|
Hi,
I'm hacking at this now for several hours, it will not compile.
I've the following declaration
<br />
class CCmdLineParserApp;
typedef BOOL (CCmdLineParserApp::*PFN_CMDLINE_ACTION)(LPCSTR pAction=NULL);<br />
<br />
typedef struct {<br />
char Switch[16];<br />
PFN_CMDLINE_ACTION pCmdAction;<br />
BOOL bIsTerminal;<br />
}CMD_LINE_ENTRY,*LP_CMD_LINE_ENTRY;<br />
Later on in the code I've found a LP_CMD_LINE_ENTRY pE. I try to execute
the Relevant pCmdAction function as follows:-
<br />
(pE ->*pCmdAction)(ResultString);<br />
I get:
C:\Projects\CmdLineParser\CmdLineParser.cpp(143) : error C2065: 'pCmdAction' : undeclared identifier
C:\Projects\CmdLineParser\CmdLineParser.cpp(143) : error C2297: '->*' : bad right operand
I do not use this syntax very often, and I'm obviously making a very silly syntactic mistake. Any ideas??
regards
Bram van Kampen
|
|
|
|
|
Bram van Kampen wrote: 'pCmdAction' : undeclared identifier
Where is pCmdAction declared? I don't see relevant code in your post
that would cause the error.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: Where is pCmdAction declared? I don't see relevant code in your post
that would cause the error.
<br />
class CCmdLineParserApp;
typedef BOOL (CCmdLineParserApp::*PFN_CMDLINE_ACTION)(LPCSTR pAction=NULL);<br />
<br />
typedef struct {<br />
char Switch[16];<br />
PFN_CMDLINE_ACTION pCmdAction; <----HERE!<br />
BOOL bIsTerminal;<br />
}CMD_LINE_ENTRY,*LP_CMD_LINE_ENTRY;<br />
pCmdAction is a member of structure CMD_LINE_ENTRY. CCmdLineParserApp, which is derrived from CWinApp, contains a static array of these. pE is a pointer into that array, and hence points to a structure of type CMD_LINE_ENTRY.
Bram van Kampen
|
|
|
|
|
Bram van Kampen wrote: (pE ->*pCmdAction)(ResultString);
You need to precede this with an instance of CCmdLineParserApp , like:
CCmdLineParserApp c;
(c.*(pE->pCmdAction))(ResultString);
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
DavidCrow wrote: You need to precede this with an instance of CCmdLineParserApp, like:
No, I forgot to tell, the code snippet is called from within a memberfunction of CCmdLineParserApp.
however I tried :(this->*(pE ->pCmdAction))(ResultString) and it worked. Have no Idea why.
Bram van Kampen
|
|
|
|
|
Bram van Kampen wrote: I tried :(this->*(pE ->pCmdAction))(ResultString) and it worked. Have no Idea why.
Because you were trying to call a CCmdLineParserApp method using a pointer
to a CMD_LINE_ENTRY as the CCmdLineParserApp object.
In your fixed version, "this" is the CCmdLineParserApp object the method is being
called in the context of, and "pE->pCmdAction" is the pointer to the method.
Much better
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark.
Bram van Kampen
|
|
|
|
|
Bram van Kampen wrote: I tried :(this->*(pE ->pCmdAction))(ResultString) and it worked. Have no Idea why.
When you call through a pointer-to-member, you have to say which object the function should get as its this pointer. If you want the function to get the current this pointer as its own this pointer, you have to say so. That's why the version with this->* works.
|
|
|
|
|
Thanks Mike.
Bram van Kampen
|
|
|
|
|
In my app, main frame has 5 child windows (base class is CWnd), the 5 children fully occupy client area of main frame and overlapped each others - similar to 5 property pages.
every time,only one of them is visible.
the 5 children are heavily painted in OnPaint().
problem is that when one is shown by ShowWindow(SW_SHOW) and others are hidden by ShowWindow(SW_HIDE), there is always some annoying visible flash at page changing time.
the reason I guess is that the paint is too heavy, so I use memory DC and disable OnEraseBkgnd() - howerver, the urgly flash still can be seen.
Do you have idea to kill the annoying flash?
Do I have to use ShowWindow() function to make one visible and others invisible?
Any suggestions are highly appreciated.
Thanks
|
|
|
|
|
What order are you making the ShowWindow(SW_SHOW) and ShowWindow(SW_HIDE)
calls in?
Try showing a child window before hiding the previous child window.
Also, if the main frame is always covered by one of the children, then
disable the main frame's OnEraseBkgnd.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|