0

GuiDropFilesGUI コントロールを使用するにはどうすればよいですか?

フォームにいくつかのeditフィールドがあり、それらにファイルを個別にドロップして操作できるようにしたいと考えています。

これは私が思いついたものです:

まず、私のコントロールは次のように設定されています。

WS_EX_ACCEPTFILES=0x10

Gui, add, edit,  vedit1, %file_1%
WinSet,ExStyle, +WS_EX_ACCEPTFILES, edit1

そして、私のドラッグドロップルーチンは次のとおりです。

GuiDropFiles:  ; Support drag & drop.
    Loop, parse, A_GuiControlEvent, `n
    {
        thisfile := a_loopfield  ; Get the first file only (in case there's more than one).
        thiscontrol := a_guicontrol
        break
    }

    alert(thisfile . "`r" . thiscontrol)

    if(thiscontrol = edit1)
        guicontrol,,%edit1%, %thisfile%
    if(thiscontrol = edit2)
        guicontrol,,%edit2%, %thisfile%
    if(thiscontrol = edit3)
        guicontrol,,%edit3%, %thisfile%

return

autohotkey ドキュメントの基本的な例を使用しています。hereの例も試しましたが、「編集ボックスにドロップされていません」と言い続けます。どんな手がかりも素晴らしいでしょう。

4

1 に答える 1

0

それを理解しました(数時間を失った後)。

まず、これは必要ありませんでした: WinSet,ExStyle, +WS_EX_ACCEPTFILES, edit1

編集コントロールにスタイルを設定する必要はありませんでした。

必要なのはこれだけでした。これは、編集コントロールの変数名が「UI_file」で始まるため、機能します。

GuiDropFiles:  ; Support drag & drop.

    Loop, parse, A_GuiEvent, `n
    {
        thisfile := A_LoopField  ; Get the first file only (in case there's more than one).
        thiscontrol := a_guicontrol
        break
    }
    ;alert(thisfile . "`r" . thiscontrol)

    If InStr(A_GuiControl, "UI_file")
        guicontrol,,%A_GuiControl%, %thisfile%

return
于 2013-06-10T22:47:43.113 に答える