madasraka Posted October 9, 2010 Share Posted October 9, 2010 i have a $ListView = GUICtrlCreateListView ("Name | Exe| Cmd| State| Flag",100,170,290,400) in my GUI and i wonder how to have it display things. I tried to mess with guictrlsetdata but that didnt get me far enough. I will have multiple objects in this listview and i cant figure out how to display one. Mauybe listview is not something i need ? Maybe there is something else i can use instead ? Can you guys give me simple example that i can understand with my low level of autoit knowledge ? Thanks in advance. Here is what i work on expandcollapse popup#Include <Misc.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region to figure out if script runs more then once. $Compiled = "Service Maker.exe" $ScriptFileName = FileExists (@ScriptDir & "\" & $Compiled) If $ScriptFileName = 0 Then MsgBox(16,"Error", 'This is not original file name. Please rename this file back to ' &@CRLF & '"' & $Compiled & '"') ;Exit EndIf if _Singleton($Compiled,1) = 0 Then Msgbox(0,"Information.","Only one instance is allowed.") Exit EndIf #EndRegion _GUI() Func _GUI() $MainGUI = GUICreate("Service Maker",400,600) GUICtrlCreateGroup ("Create new service",5,5,390,145) GUICtrlCreateLabel (" Name:",10,30,80,15) $Name = GUICtrlCreateInput ("",80,30,310,20) GUICtrlCreateLabel (" Program:",10,50,80,15) $Exe = GUICtrlCreateInput ("",80,50,250,20) $BrowseEXE = GUICtrlCreateButton ("Browse",330,50,60,20) GUICtrlCreateLabel ("Command:",10,70,80,15) $CommandLine = GUICtrlCreateInput ("",80,70,310,20) GUICtrlCreateLabel (" Flags:",10,90,60,15) $StartAtLogOn = GUICtrlCreateCheckbox ("Start at logon",80,90,80,15) $Hidden = GUICtrlCreateCheckbox ("Hidden",180,90,80,15) $AddButton = GUICtrlCreateButton ("Add specified application to the list",10,110,380,30) GUICtrlCreateGroup ("Manage added applications",5,150,390,140) $ListView = GUICtrlCreateListView ("Name | Exe| Cmd| State| Flag",100,170,290,400) GUISetState(@SW_SHOW,$MainGUI) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $BrowseEXE If GUICtrlRead ($Name) = "" Then MsgBox(64,"Error","Please specify service name first.") Else $OpenFile = FileOpenDialog ("Locate executable", "", "Executable (*.bat;*.cmd;*.exe)", 1) If $OpenFile = "" Then ElseIf $OpenFile > "" Then GUICtrlSetData ($Exe,$OpenFile) EndIf EndIf Case $AddButton If GUICtrlRead ($Name) > "" And GUICtrlRead ($Exe) > "" Then IniWrite (@ScriptDir & "\settings.ini","Application",GUICtrlRead ($Name),$OpenFile) IniWrite (@ScriptDir & "\settings.ini","Application",GUICtrlRead ($Name) & ' Command',GUICtrlRead ($CommandLine)) If GUICtrlRead ($StartAtLogOn) = 1 then IniWrite (@ScriptDir & "\settings.ini","Application",GUICtrlRead ($Name) & " Start at logon","Yes") If GUICtrlRead ($Hidden) = 1 then IniWrite (@ScriptDir & "\settings.ini","Application",GUICtrlRead ($Name) & " Hidden","Yes") GUICtrlSetData ($ListView,"||update","list") ;GUICtrlSetData ($ListView,"Name | Exe| Cmd| State| Flag") Else MsgBox (64,"Error:",'"Name" and "Program:" must be set first.') EndIf EndSwitch WEnd EndFunc Link to comment Share on other sites More sharing options...
madasraka Posted October 9, 2010 Author Share Posted October 9, 2010 I also had a question on how to create new variables. for example once i or you help me to figure out how to display things in listview then how would i go about showing multiple once ? My scripts will (i hope one day) add objects to listview and display if any from .ini file but how would i display then if i dont know how many and what the key name is in the .ini file ? Thanks for that one too Link to comment Share on other sites More sharing options...
Tvern Posted October 10, 2010 Share Posted October 10, 2010 Have a look at GUICtrlCreateListViewItem to add data to a listview. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now