|
I just retried with a simple project, and I had to set the dialog visiblity.
int MyPage::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;
BOOL bRet = myDialog.Create(IDD_DIALOG1, this);
ASSERT( bRet );
myDialog.ShowWindow(SW_SHOW);
return 0;
}
In my mainframe :
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1)
return -1;
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
CMDITabInfo mdiTabParams;
mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE;
mdiTabParams.m_bActiveTabCloseButton = TRUE;
mdiTabParams.m_bTabIcons = FALSE;
mdiTabParams.m_bAutoColor = TRUE;
mdiTabParams.m_bDocumentMenu = TRUE;
EnableMDITabbedGroups(TRUE, mdiTabParams);
CString s2("Page");
if (!myPage.Create(s2, this, CRect(0, 0, 200, 200), TRUE, ID_OPERATION_PAGE, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT| CBRS_FLOAT_MULTI))
{
TRACE0("Failed to create objectPage\n");
return FALSE;
}
myPage.EnableDocking(CBRS_ALIGN_ANY);
DockPane(&myPage);
CDockingManager::SetDockingMode(DT_SMART);
EnableAutoHidePanes(CBRS_ALIGN_ANY);
This signature was proudly tested on animals.
|
|
|
|
|
When I add the line
myDialog.ShowWindow(SW_SHOW);
It works! Thanks Maximilien. 
|
|
|
|
|
hi,
i've followed your step to pu dialog in dockpane but i can't see the dialog, i don't know how to fix this problem
Here are the steps that I took.
1. I've created a new MFC MDI project (DialogDockableTester), with Visual Studio style, maximized, and with ribbons.
2. I've created a dialog, IDD_TEMPDLG. Border = None, Style = Child.
3. Added class CTempDlg : public CDialog to use IDD_TEMPDLG
4. Added class CMyDockablePane : public CDockablePane
5. Overridden CMyDockablePane::OnCreate(LPCREATESTRUCT lpCreateStruct) with this
int CMyDockablePane::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;
BOOL bRet = m_TempoDlg.Create(IDD_TEMPDLG, this);
ASSERT( bRet );
m_TempoDlg.ShowWindow(SW_SHOW);
return 0;
}
6. Added an object of CMyDockablePane, m_MyDockablePane in CMainFrame
7. Added this line in CMainFrame::OnCreate
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
// ....
CString s2("Page");
if (!myPage.Create(s2, this, CRect(0, 0, 200, 200), TRUE, ID_OPERATION_PAGE, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT| CBRS_FLOAT_MULTI))
{
TRACE0("Failed to create objectPage\n");
return FALSE; // failed to create
}
myPage.EnableDocking(CBRS_ALIGN_ANY);
DockPane(&myPage);
CDockingManager::SetDockingMode(DT_SMART);
EnableAutoHidePanes(CBRS_ALIGN_ANY);
//...
}
in your steps you added an object of CTempDlg, m_TempDlg in CDialogDockableTesterView, and i don'nt know how to use m_TempDlg in CDialogDockableTesterView.cpp
Am I missin something?
|
|
|
|
|
I've recreated your project based on the given codes and it works. IDD_TEMPDLG is visible on the left side of the screen. An idea, CDockablePane state is automatically saved in the registry. If you're familiar with registry, you might want to delete "HKEY_CURRENT_USER > Software > Local App-Wizard Generated Applications > DialogDockableTester".
|
|
|
|
|
Hi,
what i have is a window split horizontally, and the dockpane is tranparent and on the down.
what can i do?
|
|
|
|
|
Hi there
I have a strange problem.
I call the send function to send some bytes from a TCP sockets.
The sends command blocks until the socket receives a packet from the other side.
MSDN mentions that send blocks only if there is no buffer space in TCP stack.
But I only send 100bytes (plus there is no other network traffic)
Any ideas
Thanx
|
|
|
|
|
|
try Rose, it's really pretty.
|
|
|
|
|
Just handle the WM_ERASEBKGND message.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
It's worked.
Thanks David.
|
|
|
|
|
I found this code a little confusing. Due to proprietary nature of the original source, I have to abstract this out.
What does const void return value mean? I can understand the intent of "const void*" return value, but "const void" seems to be just a typo?
Am I missing anything fancy with the construct here?
#include <stdio.h>
typedef const void (*hello)();
const void x()
{
printf("x() is called\n");
}
int main()
{
hello test=x;
test();
}
|
|
|
|
|
I don't believe you're missing anything - it does seem odd.
In fact, gcc raises a warning on a function returning const void:
a.c:2: warning: function definition has qualified void return type
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hm... which gcc are you using? Mine doesn't even complain about it.
~
$ cat x.c
#include <stdio.h>
typedef const void (*hello)();
const void x()
{
printf("x() is called\n");
}
int main()
{
hello test=x;
test();
}
~
$ gcc x.c
~
$ ./a.exe
x() is called
~
$ gcc --ver
Reading specs from /usr/lib/gcc/i686-pc-cygwin/3.4.4/specs
Configured with: /usr/build/package/orig/test.respin/gcc-3.4.4-3/configure --ver
bose --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libe
xecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-langu
ages=c,ada,c++,d,f77,pascal,java,objc --enable-nls --without-included-gettext --
enable-version-specific-runtime-libs --without-x --enable-libgcj --disable-java-
awt --with-system-zlib --enable-interpreter --disable-libgcj-debug --enable-thre
ads=posix --enable-java-gc=boehm --disable-win32-registry --enable-sjlj-exceptio
ns --enable-hash-synchronization --enable-libstdcxx-debug
Thread model: posix
gcc version 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
|
|
|
|
|
i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
crewchill wrote: I found this code a little confusing.
Yes. Working with legacy code I often find confusing items or constructs. My initial reaction is, like yours:
crewchill wrote: Am I missing anything fancy with the construct here?
Then later it becomes apparent that the author was just stupid.
On the bright side, tomorrow is FRIDAY! ![Jig | [Dance]](https://codeproject.global.ssl.fastly.net/script/Forums/Images/jig.gif)
|
|
|
|
|
Amen to Friday. My head is about to explode already.
You know the scariest part was, this is quite recent code.
The older version didn't have this and somehow the extra "const" appeared after it's being code reviewed
Not by me, mind you.
|
|
|
|
|
Hi,
MFC - VS2005, based application.
I have a number of objects, derived from the same base class. In the future I expect to be adding more.
Two views are provided on my app a CView based splitter, one is a simple list of the available objects the other is pane within which I would like each object type to render itself.
The view of each object while complex will have some similarities so I would anticipate a display class with inheritance etc.
So what might be the best way of implementing this display ?
Derive my display objects from CWnd and as the user selects each one in the list pane create and inject a new display object into the CView client area ?
Or ???
Many Thanks,
Paul C
|
|
|
|
|
How about a splitter window?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi David,
I have a splitter window.
One view is the list of available objects (which is pretty simple ) and the other is the view of the selected object.
If the second view has contain all of the code to be able to render each object type then it will be an enormous amount of code.
The list of available objects will be extended in the future and I was trying to come up with a way of having each object be able to render itself rather than have the one view 'know' about all of the objects and ultimately each time an addition was made it breaking previous code.
Or is this just a dumb idea for a Thursday afternoon....
Paul C
|
|
|
|
|
PRC wrote: Or is this just a dumb idea for a Thursday afternoon....
No, Yes, Maybe. It depends.
If these object's primary responsibility is to render then it's fine.
If these objects have more business oriented responsibility then adding rendering to them is not a good idea. Separation of concerns[^] In that case you could consider designing a rendering interface and implement however many renders you need for each type of object. You might use inheritance or any other design for the renders.
|
|
|
|
|
Hello,
you can define a draw function for each object in its class, and make that class inherited from an interface.
class Object
{
.....
virtual void draw() = 0;
....
};
class Circle : public Object
{
virtual void draw() {}
};
and call each objects'draw method in the view.
you may also want to look at the visitor pattern.
Hope this helps.
Bekir.
|
|
|
|
|
PRC wrote: ...and the other is the view of the selected object.
Which (I think) would require a separate CView -type class for each. In the pane that controls the list of available objects (e.g., OnItemChanged() method if using CListView ), figure out which object is selected and tell the splitter window to change to the corresponding view.
I did this once with a gymnastics-related application. I only had 3 items in the left pane, however.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thanks to all for the response.
Led Mike - think you may have me sorted on this one.
The objects primary intent is not to render so you are correct that Separation of concerns would suggest my idea was a bad idea.
Thanks to all for the response.
Paul C
|
|
|
|
|
|
Hi, this is the C++ forum and you're asking an MSI packaging question. Does this ring a bell?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|