home *** CD-ROM | disk | FTP | other *** search
/ PCNET 2006 September - Disc 1 / PCNET_CD_2006_09.iso / shareware / autoit-v3-setup.exe / Examples / Helpfile / _GUICtrlListViewInsertColumn.au3 < prev    next >
Encoding:
Text File  |  2006-06-17  |  1.6 KB  |  40 lines

  1. #include <GuiConstants.au3>
  2. #include <GuiListView.au3>
  3.  
  4. opt('MustDeclareVars', 1)
  5. Dim $listview, $Btn_InsertCol, $Btn_Exit, $msg, $Input_col, $Status
  6. GUICreate("ListView Insert Column", 392, 322)
  7.  
  8. $listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
  9. GUICtrlCreateListViewItem("line1|data1|more1", $listview)
  10. GUICtrlCreateListViewItem("line2|data2|more2", $listview)
  11. GUICtrlCreateListViewItem("line3|data3|more3", $listview)
  12. GUICtrlCreateListViewItem("line4|data4|more4", $listview)
  13. GUICtrlCreateListViewItem("line5|data5|more5", $listview)
  14. GUICtrlCreateLabel("Enter Column # to Insert:", 90, 190, 130, 20)
  15. $Input_col = GUICtrlCreateInput("", 220, 190, 80, 20, $ES_NUMBER)
  16. GUICtrlSetLimit($Input_col, 1)
  17. $Btn_InsertCol = GUICtrlCreateButton("Insert Column", 150, 230, 90, 40)
  18. $Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
  19. $Status = GUICtrlCreateLabel("Remember columns are zero-indexed", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
  20.  
  21. GUISetState()
  22. While 1
  23.    $msg = GUIGetMsg()
  24.    Select
  25.       Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
  26.          ExitLoop
  27.       Case $msg = $Btn_InsertCol
  28.          If (StringLen(GUICtrlRead($Input_col)) > 0) Then
  29.             If (_GUICtrlListViewInsertColumn ($listview, Int(GUICtrlRead($Input_col)), "test", 0, 40)) Then
  30.                GUICtrlSetData($Status, 'Insert column: ' & GUICtrlRead($Input_col) & ' Successful')
  31.             Else
  32.                GUICtrlSetData($Status, 'Failed to Insert column: ' & GUICtrlRead($Input_col))
  33.             EndIf
  34.          Else
  35.             GUICtrlSetData($Status, 'Must enter a column to insert')
  36.          EndIf
  37.    EndSelect
  38. WEnd
  39. Exit
  40.