Curl Global Community

Full Version: popup-messageのキャンセルボタン
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
popup-messageでcancel?=trueとしてキャンセルボタンを表示して使っています。
ポップアップが表示されたときに最初にキャンセルボタンにフォーカスがあるようにしたいのですがやり方が分かりません。初歩的なことで申し訳ありませんがよろしくお願いいたします。
ayappe 様
めちゃめちゃ汚いソースですが、実現だけなら下記できました。
もっといい方法があるかもしれません。

Code:
{popup-message "ほげほげほげ~",cancel? = true,
    {on DialogShow at dl:Dialog do
||--        {dl.become-active}
        {for c:Control in dl.controls do
            {type-switch c
             case cb:CommandButton do
                {if {cb.label.get-text} == "キャンセル" then
                    {after 0s do
                        {cb.request-key-focus}
                    }
                }
            }
        }
    }
}
(08-26-2011, 01:19 PM)onyo Wrote: [ -> ]ayappe 様
めちゃめちゃ汚いソースですが、実現だけなら下記できました。
もっといい方法があるかもしれません。

Code:
{popup-message "ほげほげほげ~",cancel? = true,
{on DialogShow at dl:Dialog do
||-- {dl.become-active}
{for c:Control in dl.controls do
{type-switch c
case cb:CommandButton do
{if {cb.label.get-text} == "キャンセル" then
{after 0s do
{cb.request-key-focus}
}
}
}
}
}
}


日本語設定されている端末以外にも使うつもりであれば、ラベルのテストを変えた方がいいです。

Code:
    {if {cb.label.get-text} == {hlmessage Cancel} then
onyo様、c-s様
ありがとうございました。

やっぱりいろいろ書かないといけないんですね><