Jump to content
Sign in to follow this  

GUICtrlCreateListViewItems from an array

Recommended Posts


Not sure how to go about displaying list items from an array. 

Opt("GUIOnEventMode", 1)


 ; ----- GUIs
Func StartGUI()
    Opt("GUICoordMode", 1)

  Global $listview, $listview2, $listview3, $listview4
  $listGUI = GUICreate("Broadcast Media Stations", 400, 500, 100, 440, -1)  ;width, height
  GUISetBkColor(0x00E0FFFF) ; will change background color
  GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close_Main")

  $tab = GUICtrlCreateTab(10, 20, 270, 320)
  $Tab_Tools = GUICtrlCreateTabItem("TV")
  GUICtrlSetState(-1, $GUI_SHOW) ; Use this!

  $listview = GUICtrlCreateListView("Shows | Channel | Port", 10, 40, 280, 380, $LVS_SORTASCENDING, $LVS_EX_GRIDLINES + $LVS_EX_FULLROWSELECT)  ;width, height, width, height
  _GUICtrlListView_SetColumnWidth($listview, 0, 140)  
   GUICtrlSetBkColor($listview, $GUI_BKCOLOR_LV_ALTERNATE)

;$aRecords[0] = "Red Dwarf | 1 | 1201"
;$aRecords[1] = "Hogan's Heros | 2 | 1202"
;For $x = 0 to 3 
   ; this should load from an file array. Change it later
  $bkcolor = "0xcceeff"
  ;GUICtrlCreateListViewItem(& $aRecords[$x], $listview)
  GUICtrlCreateListViewItem("Red Dwarf | 1 | 1201", $listview)
  GUICtrlSetBkColor(-1, $bkcolor)
  GUICtrlSetImage(-1, "C:\images\logo.ico", 0, 0)
  GUICtrlCreateListViewItem("Hogans Heros | 2 | 1202", $listview)
  GUICtrlSetBkColor(-1, $bkcolor)
 $BtnSelect = GUICtrlCreateButton("Play", 100, 450, 80, 30)
  GUICtrlSetOnEvent(-1, "SelectItem")

Share this post

Link to post
Share on other sites

In the helpfile check for the function


Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.