2323220987 发表于 2007-1-1 11:11:00

[求助]无模式对话框如何获得光标?

<p>在arx中建立无模式对话框,运行后,需要先在autocad中进行选择等操作,再回到无模式对话框中进行输入操作,但无模式对话框无法获得光标,我知道有一个keepfocus函数,但无论是返回true还是false,都无法实现光标在autocad和无模式对话框中自由切换。这个问题该如何解决?有哪位能指点一下,非常感谢1</p>

shinjikun 发表于 2007-1-13 11:56:00

<p>看文档,</p><p>在你使用acedXXXXX的时候:</p><p>1.你的类必须继承于CAdUiXXXX</p><p>2.在使用acedXXXXX之前调用BeginEditorCommand()</p><p>3.在之后根据成功失败的情况调用CompleteEditorCommand()或CancelEditorCommand();</p><p>文档中有下面的论述:</p><ol><li class="list_1" value="4">Add the button handlers for picking a point and angle using the AutoCAD editor. The BeginEditorCommand(), CompleteEditorCommand(), and CancelEditorCommand() functions are used to hide the dialog, allow the call to acedGetPoint and acedGetAngle, and finally, either cancel or redisplay the dialog based on how the user picked: </li></ol><pre class="prog_indent_1">// AsdkAcUiDialogSample message handlers</pre><pre class="prog_indent_1">void AsdkAcUiDialogSample::OnButtonPoint() </pre><pre class="prog_indent_1">{</pre><pre class="prog_indent_1">&nbsp;&nbsp;&nbsp;&nbsp;// Hide the dialog and give control to the editor</pre><pre class="prog_indent_1">&nbsp;&nbsp;&nbsp;&nbsp;//</pre><pre class="prog_indent_1">&nbsp;&nbsp;&nbsp;&nbsp;BeginEditorCommand();</pre><pre class="prog_indent_1">&nbsp;&nbsp;&nbsp;&nbsp;ads_point pt;</pre><pre class="prog_indent_1"></pre><pre class="prog_indent_1">&nbsp;&nbsp;&nbsp;&nbsp;// Get a point</pre><pre class="prog_indent_1">&nbsp;&nbsp;&nbsp;&nbsp;//</pre><pre class="prog_indent_1">&nbsp;&nbsp;&nbsp;&nbsp;if (acedGetPoint(NULL, "\nPick a point: ", pt) == RTNORM) {</pre><pre class="prog_indent_1"></pre><pre class="prog_indent_1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// If the point is good, continue</pre><pre class="prog_indent_1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//</pre><pre class="prog_indent_1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CompleteEditorCommand();</pre><pre class="prog_indent_1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_strXPt.Format("%g", pt);</pre><pre class="prog_indent_1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_strYPt.Format("%g", pt);</pre><pre class="prog_indent_1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_strZPt.Format("%g", pt);</pre><pre class="prog_indent_1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DisplayPoint();</pre><pre class="prog_indent_1">&nbsp;&nbsp;&nbsp;&nbsp;} else {</pre><pre class="prog_indent_1"></pre><pre class="prog_indent_1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// otherwise cancel the command (including the dialog)</pre><pre class="prog_indent_1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CancelEditorCommand();</pre><pre class="prog_indent_1">&nbsp;&nbsp;&nbsp;&nbsp;}</pre><pre class="prog_indent_1">}</pre>

shinjikun 发表于 2007-1-13 11:58:00

<div class="HeadingOverlayNew">CAdUiBaseDialog::BeginEditorCommand Function
        </div><p class="signature">void</p><p class="signature">BeginEditorCommand();</p><p>Call this method to indicate an AutoCAD interactive command is starting. </p><p>Example: </p><pre>    BeginEditorCommand();
    if (DoMyInteractiveCommand())
      CompleteEditorCommand();
    else
      CancelEditorCommand();</pre>
页: [1]
查看完整版本: [求助]无模式对话框如何获得光标?