- UID
- 1
- 积分
- 15892
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-1-3
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
How can I use acedGetxxx() functions from a MFC modal dialog box ?
ID 1597
Applies to: AutoCAD 2000
AutoCAD 2000I
AutoCAD 2002
This document is part of MFC
Question
How can I use acedGetXXX() functions from a MFC modal dialog box ?
Answer
There is no user intervention allowed at the AutoCAD main frame window or other
child windows when a child modal dialog is active. Since acedGetXXX functions
need to get user inputs mostly, they cannot be used pending an active modal
dialog.
Fortunately, you can hide and activate a modal dialog in your ARX application
inside AutoCAD. Generally speaking, when a modal dialog is active, MFC disables
the access to the parent window until the modal dialog is dismissed. This is
true for most of the windows applications, so there is no exception for AutoCAD.
To do this, you need to hide the modal dialog first, activate the parent, do
acedGetXXX(), activate the modal dialog, set the focus on it and set the parent
window disabled.
- GetParent ()->EnableWindow (TRUE) ; // Enable the parent
- ShowWindow (SW_HIDE) ; // Hide ourself
- GetParent ()->SetFocus () ; // Give focus to the parent
- // you do not really need to
- // do that (but it's better)
- ads_point pt ; // Do something...
- acedGetPoint (NULL, "\nPick a point: ", pt) ;
- acutPrintf ("\nYou picked (%.2lf, %.2lf, %.2lf,)\n",
- pt [X], pt [Y], pt [Z]
- ) ;
- ShowWindow (SW_SHOW) ; // Show ourself
- SetFocus () ; // Give focus to ourself
- GetParent ()->EnableWindow (FALSE) ; // Disable the parent
- EnableWindow (TRUE) ; // Because our parent was disabled
- // we need to enable ourself
复制代码 |
|