Компьютерный форум OSzone.net  

Компьютерный форум OSzone.net (http://forum.oszone.net/index.php)
-   AutoIt (http://forum.oszone.net/forumdisplay.php?f=103)
-   -   [решено] TreeView с чекбоксами (http://forum.oszone.net/showthread.php?t=146437)

crashtuak 28-07-2009 10:49 1179627

TreeView с чекбоксами
 
Вот есть код т деревом без чекбоксов:
Код:

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 448, 193, 125)
$TreeView1 = GUICtrlCreateTreeView(8, 8, 209, 153)
$TreeView1_0 = GUICtrlCreateTreeViewItem("qwerty", $TreeView1)
$TreeView1_1 = GUICtrlCreateTreeViewItem("qwe1", $TreeView1_0)
$TreeView1_2 = GUICtrlCreateTreeViewItem("qwe2", $TreeView1_0)
$Button1 = GUICtrlCreateButton("Button1", 224, 8, 65, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

                Case $Button1
                        MsgBox(0, "Test", "This box will show test text")
        EndSwitch
WEnd

Делался с помощью Koda.
В Koda делаю дерево с чекбоксами, генерирует такой код:
Код:

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 448, 193, 125)
$TreeView1 = GUICtrlCreateTreeView(8, 8, 209, 153, BitOR($TVS_HASBUTTONS,$TVS_HASLINES,$TVS_LINESATROOT,$TVS_DISABLEDRAGDROP,$TVS_SHOWSELALWAYS,$TVS_CHECKBOXES,$WS_GROUP,$WS_TABSTOP))
$TreeView1_0 = GUICtrlCreateTreeViewItem("qwerty", $TreeView1)
$TreeView1_1 = GUICtrlCreateTreeViewItem("qwe1", $TreeView1_0)
$TreeView1_2 = GUICtrlCreateTreeViewItem("qwe2", $TreeView1_0)
$Button1 = GUICtrlCreateButton("Button1", 224, 8, 65, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

                Case $Button1
        EndSwitch
WEnd

При попытке запустить скрипт:
Код:

>"F:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "F:\Documents and Settings\CrashTUA\Local Settings\Temp\test.au3"   
F:\Documents and Settings\CrashTUA\Local Settings\Temp\test.au3 (5) : ==> Variable used without being declared.:
$TreeView1 = GUICtrlCreateTreeView(8, 8, 209, 153, BitOR($TVS_HASBUTTONS,$TVS_HASLINES,$TVS_LINESATROOT,$TVS_DISABLEDRAGDROP,$TVS_SHOWSELALWAYS,$TVS_CHECKBOXES,$WS_GROUP,$WS_TABSTOP))
$TreeView1 = GUICtrlCreateTreeView(8, 8, 209, 153, BitOR(^ ERROR
>Exit code: 1    Time: 0.225

Кто поможет?

crashtuak 28-07-2009 11:08 1179646

Ну нашел проблему, надо было дописать:
Код:

#include <WindowsConstants.au3>
#include <TreeViewConstants.au3>



Время: 10:22.

Время: 10:22.
© OSzone.net 2001-