• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

F_ApiModelessDialog() の使い方

New Here ,
Apr 18, 2004 Apr 18, 2004

Copy link to clipboard

Copied

質問があります。FDK7.0(WinXP, FM7.0)において、F_ApiModelessDialog()で作成したダイアログの動きがおかしいのです。
表示させたダイアログの×ボタンを押した後、F_ApiClose()を呼んでもダイアログが終了しません。
以下がソースの抜粋です。

F_ObjHandleT g_hDlgId;

VoidT
F_ApiDialogEvent(
IntT dlgNum,
IntT itemNum,
IntT modifiers
)
{
if(itemNum == FV_DlgClose)
{
F_ApiClose(g_hDlgId, 0);
}
}

VoidT F_ApiCommand(IntT command)
{
g_hDlgId = F_ApiOpenResource(FO_DialogResource, (StringT)"Test");
F_ApiModelessDialog(1, g_hDlgId);

return;
}

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 27, 2004 Apr 27, 2004

Copy link to clipboard

Copied

rocket21さま。

F_ApiClose()のflags引数に0を指定するとエラーになると思いますが、
F_ApiClose()の後のエラーを調べてみましたか?
ダイアログを閉じる際には、
 F_ApiClose(ダイアログid, FF_CLOSE_MODIFIED);
では?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 29, 2004 Apr 29, 2004

Copy link to clipboard

Copied

お答えいただき、ありがとうございます。

しかし、ダイアログを閉じる際のF_ApiClose()の引数に、(ダイアログID, 0) ではないでしょうか?
FDK7.0 Programmer's Guideの227ページには第2引数に0を使っています。

本題の件はどうやっても上手くいきません。

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 30, 2004 Apr 30, 2004

Copy link to clipboard

Copied

rocket21さま、こんにちわ。

FDKのdaialogサンプルソースでは、
F_ApiClose(ダイアログid, F_CLOSE_MODIFIED);
という使い方してるんですよ…。
でも、確かにflags引数に0を指定するように書いてありますね。すいません。

ちなみに、サンプルソースは上手く動きますか?

ふと疑問に思ったのですが。
ダイアログリソースの定義が分からないので、おそらく、というレベルですが、
FV_DlgCloseのアイテム番号でイベント発生してますか?
表示させたダイアログの×ボタンを押した後は、キャンセルボタンのアイテムの番号でイベントが発生すると思うのですが。

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 30, 2004 Apr 30, 2004

Copy link to clipboard

Copied

いろいろとご返事ありがとうございます。

サンプルを動作させると見事に動作します。

サンプルにキャンセルボタンを付けて、このボタンが押された場合に、F_ApiClose()を呼ぶようにすると、ダイアログが閉じません。

この結果から、F_ApiClose()関数の有無なのですが、F_ApiModelessDialog()を使った場合に、F_ApiClose()を呼んではいけないのでしょうか?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 07, 2004 May 07, 2004

Copy link to clipboard

Copied

rocket21さま。

まず1つ訂正です。
「表示させたダイアログの×ボタンを押した後は、キャンセルボタンのアイテムの番号でイベントが発生」は、
Modelの場合のようです、すいませんでした。

で、Model/Modelessに関わらず、ダイアログを閉じるのはF_ApiClose()ですよね。

FDKのサンプルソースは正常に動いたという事ですが、
サンプルには元々キャンセルボタンがあるので、
ソースのF_ApiModalDialog()の部分をF_ApiModelessDialog()に変更しただけではどうですか?
(自分のところでは、これで確認してみました。問題なくF_ApiClose()が動いてます)

正常に動いたのであれば、F_ApiClose()というよりも、
実装のどこかに不備がある、という疑いが出てきます。
正常に動かないのであれば別問題(OS?)かと思いますが…。

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 08, 2004 May 08, 2004

Copy link to clipboard

Copied

ymgc 様

こちらの疑問について毎回お答えいただきありがとうございます。
FDK7.0 Programmer's Guide の215ページのサンプル(A Simple Example)を見ると、F_ApiClose()がありません。
やはり、モードレスダイアログのときは、いらないのでは?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 10, 2004 May 10, 2004

Copy link to clipboard

Copied

rocket21さま。

論点を整理します。

> FDK7.0 Programmer's Guide の215ページのサンプル(A Simple Example)を見ると、F_ApiClose()がありません。
> やはり、モードレスダイアログのときは、いらないのでは?
ダイアログの×ボタンが押された、というアクションの場合は、F_ApiClose()は必要ありません。

しかし、
> F_ApiModelessDialog()を使った場合に、F_ApiClose()を呼んではいけないのでしょうか?
ダイアログ内に配置したボタン等が押された、というアクションで閉じたい場合は、
F_ApiClose()でダイアログを閉じる必要があるので、呼んではいけない、という事にはならないです。

サンプルはあくまで参考とするだけで、実際にどんなダイアログを実装するかによると思います。
今、問題として残るのは、rocket21さまのマシンで、F_ApiClose()が動かない、という点ではないですか?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 12, 2004 May 12, 2004

Copy link to clipboard

Copied

LATEST
動作しました!

Windowsのプラットフォームガイドを見直していたら、コンパイル時の構造体のバウンダリを8にする指定が抜けていました。
これを直すと、モードレスダイアログでのF_ApiClose()が正常に動作しました。
ありがとうございました。
こちらの疑問に最後まで付き合って頂いて、ありがとうございました。

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines