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

  1. #include <GuiConstants.au3>
  2. #include <GuiListView.au3>
  3.  
  4. Opt ('MustDeclareVars', 1)
  5. Dim $listview, $Btn_HideCol, $Btn_Exit, $msg, $Input_col, $Status, $Btn_ShowCol
  6. GUICreate("ListView Hide Column Sets Column Width to Zero", 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 Hide:", 90, 190, 130, 20)
  15. $Input_col = GUICtrlCreateInput("", 220, 190, 80, 20, $ES_NUMBER)
  16. GUICtrlSetLimit($Input_col, 1)
  17. $Btn_HideCol = GUICtrlCreateButton("Hide Column", 75, 230, 90, 40)
  18. $Btn_ShowCol = GUICtrlCreateButton("Show Column", 200, 230, 90, 40)
  19. $Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
  20. $Status = GUICtrlCreateLabel("Remember columns are zero-indexed", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
  21.  
  22. GUISetState()
  23. While 1
  24.     $msg = GUIGetMsg()
  25.     Select
  26.         Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
  27.             ExitLoop
  28.         Case $msg = $Btn_HideCol
  29.             If (StringLen(GUICtrlRead($Input_col)) > 0) Then
  30.                 If (_GUICtrlListViewHideColumn ($listview, Int(GUICtrlRead($Input_col)))) Then
  31.                     GUICtrlSetData($Status, 'Hide column: ' & GUICtrlRead($Input_col) & ' Successful')
  32.                 Else
  33.                     GUICtrlSetData($Status, 'Failed to Hide column: ' & GUICtrlRead($Input_col))
  34.                 EndIf
  35.             Else
  36.                 GUICtrlSetData($Status, 'Must enter a column to hide')
  37.             EndIf
  38.         Case $msg = $Btn_ShowCol
  39.             If (StringLen(GUICtrlRead($Input_col)) > 0) Then
  40.                 If (_GUICtrlListViewSetColumnWidth ($listview, Int(GUICtrlRead($Input_col)), $LVSCW_AUTOSIZE)) Then
  41.                     GUICtrlSetData($Status, 'Show column: ' & GUICtrlRead($Input_col) & ' Successful')
  42.                 Else
  43.                     GUICtrlSetData($Status, 'Failed to Show column: ' & GUICtrlRead($Input_col))
  44.                 EndIf
  45.             Else
  46.                 GUICtrlSetData($Status, 'Must enter a column to show')
  47.             EndIf
  48.     EndSelect
  49. WEnd
  50. Exit
  51.