「Done dialog」の版間の差分
編集の要約なし |
編集の要約なし |
||
| 51行目: | 51行目: | ||
) | ) | ||
</pre> | </pre> | ||
DCLファイル | |||
<pre class="brush:autolisp;"> | |||
hidedcl : dialog | |||
{ label="隠すサンプル"; | |||
: column | |||
{ : text | |||
{ key="message"; | |||
label="[点を指定]をクリック"; | |||
fixed_width=true; | |||
fixed_height=true; | |||
alignment=centered; | |||
} | |||
:row | |||
{ ok_only; | |||
:retirement_button | |||
{ label = "点を指定"; | |||
key = "hide"; | |||
mnemonic = "H"; | |||
}}}} | |||
</pre> | |||
[[Category:AutoLISP]] | [[Category:AutoLISP]] | ||
2011年5月27日 (金) 12:37時点における版
- 構文
- (done_dialog [status])
- 機能
- ダイアログ ボックスを終了する。
- 引数
-
- status : [OK]に対して1、[キャンセル]に対して0を返す代わりに、start_dialog が返す正の整数。2以上の status 値の意味は、アプリケーションが決定する。
- * done_dialog はアクション式かコールバック関数内から呼び出す必要がある(「action_tile」参照)。
- 戻り値
- 2D の点リスト。 このリストは、ユーザがダイアログを終了したときの(X,Y)位置を表す。
- 使用上の注意
- キーが "accept" または "cancel" であるボタン(通常は[OK]ボタンと[キャンセル]ボタン)にコールバックを割り当てる場合、そのコールバックは done_dialog を明示的に呼び出さなければならない。呼び出さない場合、ダイアログ から抜けられなくなる可能性がある。これらのボタンに明示的なコールバックを与えずに標準の終了ボタンを使用する場合、CAD が自動的に処理する。
- 又、[accept]ボタンに割り当てられる明示的な LISP関数は、status として 1(又はアプリケーションで定義される値)を指定しなければならない。それ以外の場合、start_dialog は既定値の 0を返す。この場合、ダイアログがキャンセルされたように見える。
(defun c:hidedcl (/ dcl_id what_next cnt)
(setq dcl_id (load_dialog "hidedcl.dcl")) ;ダイアログ ボックスをロード。
(setq what_next 2)
(setq cnt 1)
(while (>= what_next 2) ;表示ループを開始。
(if (null (new_dialog "hidedcl" dcl_id)) ;ダイアログ ボックスを初期化。
(exit) ;nil が返された場合は終了。
)
; ボタンが押された場合のアクションを設定します。ボタンが
; 押されると done_dialog が呼び出され、ダイアログ ボックスが閉じます。
; 各ボタンは固有のステータス コードを done_dialog に関連付けて、
; このステータス コードは start_dialog によって返される。
(action_tile "accept" "(done_dialog 1)") ;[OK]のアクションを設定します。
(action_tile "hide" "(done_dialog 4)") ;[点を指定]のアクションを設定
;します。
(setq what_next (start_dialog)) ;ダイアログ ボックスを表示します。
;
(cond
((= what_next 4) ;点を指定するようユーザに
(getpoint "¥n点を指定: ") ;要求します。
)
((= what_next 0)
(prompt "¥nユーザによりダイアログがキャンセルされました")
)
)
)
(unload_dialog dcl_id)
(princ)
)
DCLファイル
hidedcl : dialog
{ label="隠すサンプル";
: column
{ : text
{ key="message";
label="[点を指定]をクリック";
fixed_width=true;
fixed_height=true;
alignment=centered;
}
:row
{ ok_only;
:retirement_button
{ label = "点を指定";
key = "hide";
mnemonic = "H";
}}}}