- UID
- 1
- 积分
- 16111
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-1-3
- 最后登录
- 1970-1-1
|
发表于 2002-8-30 20:37:34
|
显示全部楼层
How to use some of the acui features?
ID 41309
Applies to: AutoCAD 2000
Date 5/18/2000
This document is part of AcUi/AdUi ObjectARX MFC ObjectARX Technical Newsletter - October 1999 ObjectARX Technical Newsletter - November 1999
Question
How do I use some of the ACUI features in AutoCAD 2000? Specifically, how do I
use AcUiDockControlBar and the ActiveX control in it? I don't know how to
display the dock bar and the ActiveX control seems to disappear when I insert it
into a project and am able to view it in the Resource editor.
Answer
Some of the AcUi features are not intuitive as third party developers do not
have access to the AutoCAD frame window source code. Because the frame window is
usually where the dock site and dockbars are handled, it has created some
difficulty for third party developers. To compound matters, not much detailed
documentation exists for AcUi features.
Fortunately, there are other approaches to take. For the dockable control bar,
we have implemented the CAcUiDockControlBar. Most of the wor behind the API so
for the developers, it is relative easy.
A sample application is attached that fully demonstrates how to make it work.
NOTE: The attached sample assumes you have knowledge about the MFC extension
DLL, temporary resource overrides, and workarounds to the the debug/release.
To explain some of the specialties, for example, you need to follow a specific
calling sequence to create the dockbar. In addition, the following code allows
you to save and restore the dockbar state:
//
// a unique ID
//
static CLSID clsIDControlBar = // {9856E678-A4F7-11d2-BA6A-0060B0B5E151}
{ 0x9856e678, 0xa4f7, 0x11d2, { 0xba, 0x6a, 0x0, 0x60, 0xb0, 0xb5, 0xe1,
0x51 }
};
//
// notice the global variable gpDlgBar
//
void testDlgBar()
{
CMDIFrameWnd *pAcadFrame = acedGetAcadFrame();
if(!gpDlgBar)
{
gpDlgBar = new CTestDialogBar;
CAcModuleResourceOverride resOverride;
const char dlgName[] = "TestDialogBar";
gpDlgBar->Create(pAcadFrame, dlgName);
gpDlgBar->SetToolID (&clsIDControlBar);
gpDlgBar->EnableDocking(CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT);
gpDlgBar->RestoreControlBar();
}
else
pAcadFrame->ShowControlBar (gpDlgBar, TRUE, FALSE);
}
Regarding the disappearance of the ActiveX control or other types of control in
the CAcUiDockControlBar, this behavior is different than what you usually
experience in MFC when you insert a resource into a dialog or dialog bar
template.
To make it work, you first need to call Create() method to create the ActiveX
control. Secondly, subclass the window so that messages can be directed
through. Thirdly, handle resizing so your control is sized properly all the
time.
The attached sample demonstrates two type of controls in the dockbar. One is a
treeview control; the other is the Whip OCX control.
NOTE: This sample also demonstrates some other features of AcUi. |
|