dazza Posted February 15, 2008 Posted February 15, 2008 I populate a listbox with lines from a file. I see the listbox being filled up but then at the end--it clears itself! $calls is the name of the listbox ; extract file $file_name = GUICtrlRead($config) $file = FileOpen($file_name, 0) while 1 $line = FileReadLine($file) GUICtrlSetData($calls, $line) Wend FileClose($file)
Danny35d Posted February 15, 2008 Posted February 15, 2008 I populate a listbox with lines from a file. I see the listbox being filled up but then at the end--it clears itself! The last line in the file is NUL so GUICtrlSetData() takes the NUL and clear the listbox Change:GUICtrlSetData($calls, $line)oÝ÷ Ù:ºÚ"µÍY ÌÍÛ[H ÉÝÈ ][ÝÉ][ÝÈ[ÕRPÝÙ]]J ÌÍØØ[Ë ÌÍÛ[J AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Aceguy Posted February 15, 2008 Posted February 15, 2008 (edited) while 1 $line = FileReadLine($file) GUICtrlSetData($calls, $line) Wend need to be $ct=0 do $line = Filereadline($file,$ct) guictrlsetda($calls,$line) $ct+=1 until @error = -1 Edited February 15, 2008 by Aceguy [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock
dazza Posted February 15, 2008 Author Posted February 15, 2008 (edited) Works a treat. Many thanks. Now... I need a loop that processes each item of the listbox eg While not end of listbox alpha = listbox(next_item) do_stuff(alpha) Wend Edited February 15, 2008 by dazza
ProgAndy Posted February 15, 2008 Posted February 15, 2008 use #Include <GuiListBox.au3> $count = _GUICtrlListBox_GetCount(GUICtrlGetHandle($ListBox)) For $index = 1 To $count-1 _GUICtrlListBox_GetText(GUICtrlGetHandle($ListBox),$index) Next *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
dazza Posted February 15, 2008 Author Posted February 15, 2008 My build doesn't have GuiListBox3. Is there a way of extracting each item (and having it selected) without the above?
Zedna Posted February 15, 2008 Posted February 15, 2008 My build doesn't have GuiListBox3. Is there a way of extracting each item (and having it selected) without the above? ;~ $LB_GETCOUNT = 0x18B ;~ $LB_GETTEXT = 0x189 $hwnd_lb = ControlGetHandle("Your title","","ListBox1") $count = dllcall("user32.dll","int","SendMessage","hWnd",$hwnd_lb,"int",$LB_GETCOUNT,"int",0,"int",0) For $i = 0 to $count[0] - 1 $line_text = dllcall("user32.dll","int","SendMessage","hWnd",$hwnd_lb,"int",$LB_GETTEXT,"int",$i,"str","") $line_text = $line_text[4] ConsoleWrite($line_text & @LF) Next Resources UDF ResourcesEx UDF AutoIt Forum Search
dazza Posted February 20, 2008 Author Posted February 20, 2008 This code picks out each member of the list beautifully--many thanks. Is there a way I can highlight each member as it's processed. i.e. make the 7th member (of the listbox) selected (darkened out)
Zedna Posted February 20, 2008 Posted February 20, 2008 Is there a way I can highlight each member as it's processed.i.e. make the 7th member (of the listbox) selected (darkened out)Const $LB_SETCURSEL = 0x186use SendMessage API Resources UDF ResourcesEx UDF AutoIt Forum Search
GaryFrost Posted February 20, 2008 Posted February 20, 2008 Const $LB_SETCURSEL = 0x186use SendMessage APIOr get the latest version SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
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