pqs001 发表于 2005-9-9 09:49:00

无法隐藏模式对话框

<P>用以下代码创建了一个模式对话框:</P>
<P><STRONG>CAcModuleResourceOverride&nbsp; resOveride;<BR>CModalDlg pDlg(CWnd::FromHandle(adsw_acadMainWnd()));<BR>pDlg.DoModal();</STRONG></P>
<P>点对话框中一个按钮,添加如下代码,希望隐藏对话框:</P>
<P><STRONG>ShowWindow(SW_HIDE);</STRONG></P>
<P>对话框是隐藏了,但焦点回不了acad的主界面了,就是鼠标点不了acad的界面,包括菜单、绘图区等等,没有任何错误提示,程序也没有“无响应”。</P>
<P>请问大家,这是怎么回事?</P>

王咣生 发表于 2005-9-9 10:57:00

reply

你可以使用CAcUiPickButton,在事件处理中用<BR>&nbsp;&nbsp; BeginEditorCommand();<BR>&nbsp;&nbsp; CancelEditorCommand();<BR>参见..\arx_sdk\ObjectARX2004\samples\editor\mfcsamps\acuisample_dg例子

hulei_accp 发表于 2005-9-9 11:32:00

是的.grass说的有道理。

pqs001 发表于 2005-9-9 21:54:00

<P>谢谢<A name=55883><FONT color=#990000><B>王咣生</B></FONT></A>斑竹!</P>

pqs001 发表于 2005-9-10 10:13:00

<P>现在点击了模式对话框的按钮,生成一条直线,只有退出模式对话框才能显示该直线,请问要如何才能更新绘图区呢?</P>

yfy2003 发表于 2005-9-10 10:19:00

<P>更新绘图区acedGetAcadDwgView()-&gt;UpdateWindow();</P>
<P>&nbsp;</P>

pqs001 发表于 2005-9-10 10:31:00

yfy2003发表于2005-9-10 10:19:00static/image/common/back.gif
更新绘图区acedGetAcadDwgView()-&gt;UpdateWindow();



<P><BR>用了这行代码还是没有什么反应的</P>
<P><STRONG>&nbsp;</STRONG>BeginEditorCommand();</P>
<P>&nbsp;//焦点给acad主窗体<BR>&nbsp;AfxGetMainWnd()-&gt;SetFocus();<BR>&nbsp;//将当前文档锁定,因为要写入实体了 <BR>&nbsp;acDocManager-&gt;lockDocument( acDocManager-&gt;curDocument(), AcAp::kWrite, <BR>&nbsp;&nbsp;NULL, <BR>&nbsp;&nbsp;NULL,true) ;&nbsp;<BR></P>
<P>&nbsp;//添加直线到块表记录<BR>&nbsp;AcDbBlockTable*&nbsp; pBlockTable=NULL;<BR>&nbsp;AcDbBlockTableRecord* pSpaceRecord=NULL;<BR>&nbsp;acdbHostApplicationServices()-&gt;workingDatabase()-&gt;getSymbolTable(pBlockTable, AcDb::kForRead);<BR>&nbsp;pBlockTable-&gt;getAt(ACDB_MODEL_SPACE, pSpaceRecord, AcDb::kForWrite);<BR>&nbsp;pBlockTable-&gt;close();</P>
<P>&nbsp;AcDbLine *pLine=new AcDbLine(stPntNew,edPntNew);</P>
<P>&nbsp;pSpaceRecord-&gt;appendAcDbEntity(LineId,pLine);<BR>&nbsp;pSpaceRecord-&gt;close();</P>
<P>&nbsp;//添加新层<BR>&nbsp;AcDbLayerTable *pLayerTable;<BR>&nbsp;acdbHostApplicationServices()-&gt;workingDatabase()-&gt;getSymbolTable(pLayerTable, AcDb::kForWrite);<BR>&nbsp;if(!pLayerTable-&gt;has("Line"))<BR>&nbsp;{<BR>&nbsp;&nbsp;AcDbLayerTableRecord *pLayerTableRecord=new AcDbLayerTableRecord;<BR>&nbsp;&nbsp;pLayerTableRecord-&gt;setName("Line");<BR>&nbsp;&nbsp;pLayerTable-&gt;add(pLayerTableRecord);<BR>&nbsp;&nbsp;pLayerTableRecord-&gt;close();<BR>&nbsp;}<BR>&nbsp;pLayerTable-&gt;close();<BR>&nbsp;pLine-&gt;setLayer("Line");<BR>&nbsp;pLine-&gt;setColorIndex(1);</P>
<P>&nbsp;pLine-&gt;close();</P>
<P><FONT color=#ff0000>&nbsp;<STRONG>//更新绘图区域<BR>&nbsp;acedGetAcadDwgView()-&gt;UpdateWindow();</STRONG></FONT><BR><STRONG>&nbsp;</STRONG>//文档解锁<BR>&nbsp;acDocManager-&gt;unlockDocument(acDocManager-&gt;curDocument());</P>
<P>&nbsp;//返回模式对话框<BR>&nbsp;CompleteEditorCommand();<BR></P>

王咣生 发表于 2005-9-10 23:23:00

<FONT face=新宋体>&nbsp;&nbsp;&nbsp;</FONT>// 刷新显示屏幕 <BR>&nbsp;&nbsp;&nbsp;actrTransactionManager-&gt;flushGraphics(); <BR>&nbsp;&nbsp;&nbsp;acedUpdateDisplay();

pqs001 发表于 2005-9-12 20:44:00

<FONT color=#990000><FONT color=#000000>谢谢</FONT><STRONG> </STRONG><A name=56256><FONT color=#990000><STRONG>王咣生</STRONG></FONT></A><STRONG>&nbsp;yfy2003 </STRONG><FONT color=#000000>斑竹,问题已解决了</FONT></FONT>
页: [1]
查看完整版本: 无法隐藏模式对话框