Trax Posted February 29, 2020 Share Posted February 29, 2020 First I am not really sure I should be using a list box but can't find much better. It is a Window used to display a single value only. I don't really need a list. So is a ListBox what I should be using? Anyway.... I want to put a value in a ListBox and have it be the only value in that ListBox. The only way I have found to do it is to delete what is there first then add it: _GUICtrlListBox_DeleteString($List4, 0) _GUICtrlListBox_AddString($List4, $Calculated15MinPeriod) Isn't that a command that will simply overwrite whatever is there with a new value? A single command rather then having to delete it first? Thanks in advance! Link to comment Share on other sites More sharing options...
seadoggie01 Posted February 29, 2020 Share Posted February 29, 2020 Sounds like you're looking for _GUICtrlListBox_SetItemData I think that a list box isn't really what you're looking for though... you can use an Input if there is text that needs to be able to be edited by the user, or a Label for text that doesn't. All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
Trax Posted March 1, 2020 Author Share Posted March 1, 2020 Thanks @seadoggie01 . I tried a lot of _GuiCtrlListBox functions but overlooked that one. The boxes are display only. i.e. read data, move to control. Loop. No input or editing. Link to comment Share on other sites More sharing options...
Trax Posted March 1, 2020 Author Share Posted March 1, 2020 Yep. Having a mental block on this one. Here is what I had and it seems to work. It would display in the ListBox: _GUICtrlListBox_DeleteString($List1, 0) _GUICtrlListBox_AddString($List1, $CurrentDate) I tried this and nothing displayed in the ListBox: _GUICtrlListBox_SetItemData($List1, 0, $CurrentDate) Link to comment Share on other sites More sharing options...
Nine Posted March 1, 2020 Share Posted March 1, 2020 No _GUICtrlListBox_SetItemData replaces the internal value of an item list box. If you want to change the displayed value use _GUICtrlListBox_ReplaceString “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
TheXman Posted March 1, 2020 Share Posted March 1, 2020 (edited) 21 hours ago, Trax said: First I am not really sure I should be using a list box but can't find much better. It is a Window used to display a single value only. I don't really need a list. So is a ListBox what I should be using? You obviously haven't spent enough time reading the help file's documentation on GUI's and the GUI controls that are available. If you know that you want to "display a single value only", what would make you come to the conclusion that a ListBox would be a good choice to display a single value? What is it about the words "single value" makes you think a control with the word "List" in its name would be applicable? Maybe now is a good time to go back to the help file and do a little more research. If you are looking for a good starting point to get a visual representation of many of the controls that are available, then I would start with the help file topic named "GUI Concepts". There, among other things, you will find a list of controls, a brief description of each control, and a sample GUI that displays several of the controls, Here's a link to the online version of the GUI Concepts help file page. That page also has a related example script that displays the sample GUI so you can you can see an example of how to implement those controls and how a user can interact with them. The example script can be found in ...\AutoIt3\Examples\GUI\SampleControls.au3. I would suggest copying that script to a different location so that you can modify the script as necessary while you are learning which ones may be best for your needs and how to manipulate them. To answer your specific question, if it is a single line of information that needs to be displayed and overwritten as needed, a "Label" control might be a better choice. If you need a user to be able to enter a single value, then an "Input" control might be a good choice. Not knowing more about the data and it's intended use within your GUI, those are just guesses based on you stated requirement. Edited March 1, 2020 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Trax Posted March 1, 2020 Author Share Posted March 1, 2020 @TheXman that is easy for you to say. You have probably been doing AutoIT for a couple years with an emphasis on GUI. To say the least the documentation is daunting. I have spent more time in the Wiki and reading function descriptions then I really want to think about. I put out a good effort before asking the question. Thanks you for the answer..... Link to comment Share on other sites More sharing options...
TheXman Posted March 1, 2020 Share Posted March 1, 2020 You're welcome. And, yes, it was very easy for me to say since I've been using AutoIt, on almost a daily basis, for over 12 years. CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
BigDaddyO Posted March 2, 2020 Share Posted March 2, 2020 (edited) sound like your just building a status box. you can use a sunken label and use a simple GuiCtrlSetData to update whenever you want. #include <GUIConstantsEx.au3> #include <StaticConstants.au3> GUICreate("My GUI") ; will create a dialog box that when displayed is centered $iLabelNbr = 1 GUICtrlCreateLabel("Label " & $iLabelNbr & ", Normal", 10, 30, 200, 20) $iLabelNbr += 1 $hLbl2 = GUICtrlCreateLabel("Label " & $iLabelNbr & ", Sunken", 10, 60, 200, 20, $SS_SUNKEN) $hBtn = GUICtrlCreateButton("Update Sunken Label", 10, 120, 120, 20) GUISetState(@SW_SHOW) ; will display an empty dialog box ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $hBtn $iLabelNbr += 1 GUICtrlSetData($hLbl2, "Label " & $iLabelNbr & ", Sunken") EndSwitch WEnd edit: I've been using AutoIt before it had the ability to create a GUI and I find new things it's capable of on a weekly basis. Edited March 2, 2020 by BigDaddyO 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