taylansan Posted February 2, 2022 Share Posted February 2, 2022 Hello, In the GUICtrlCreateList default example, whenever I click the Add button I can see "You clicked button No1" is added into the list. But the list is always kept on the top (red arrows). I want to go the end of the list whenever I click the Add button (green arrows). This is the original example of GUICtrlCreateList (except the two commented lines which I added them). I know I need to add something after Case $idButton_Add: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Example() Func Example() Local $sMESSAGE = "The following buttons have been clicked" GUICreate("My GUI list") ; will create a dialog box that when displayed is centered Local $idButton_Add = GUICtrlCreateButton("Add", 64, 32, 75, 25) Local $idButton_Clear = GUICtrlCreateButton("Clear", 64, 72, 75, 25) Local $idMylist = GUICtrlCreateList("buttons that have been clicked", 176, 32, 121, 97) GUICtrlSetLimit(-1, 200) ; to limit horizontal scrolling GUICtrlSetData(-1, $sMESSAGE) Local $idButton_Close = GUICtrlCreateButton("my closing button", 64, 160, 175, 25) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idButton_Add GUICtrlSetData($idMylist, "You clicked button No1|") ;I think I need to add something here, to make the list jump to the last item ;GUICtrlSetState($idMylist, "go to the last item") Case $idButton_Clear GUICtrlSetData($idMylist, "") Case $idButton_Close MsgBox($MB_SYSTEMMODAL, "", "the closing button has been clicked", 2) Exit EndSwitch WEnd EndFunc ;==>Example I looked for the GUICtrlSetState function, but I couldn't find which parameter I should use to go to the last item in the list. I don't want to force send keys such as Send("{END}") which will of course go the last element. How can I go to the last item in the list? Is GUICtrlSetState function with a special parameter or a different function? TY. Link to comment Share on other sites More sharing options...
Solution TheXman Posted February 2, 2022 Solution Share Posted February 2, 2022 (edited) 3 hours ago, taylansan said: I want to go the end of the list whenever I click the Add button (green arrows). How can I go to the last item in the list? You can use _GUICtrlListBox_SetCurSel() to set the current selection to the last entry in the listbox and scroll it into view. #include <GuiListBox.au3> . . . Case $idButton_Add GUICtrlSetData($idMylist, "You clicked button No1|") _GUICtrlListBox_SetCurSel($idMylist, _GUICtrlListBox_GetCount($idMylist) - 1) Edited February 2, 2022 by TheXman taylansan 1 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...
Nine Posted February 2, 2022 Share Posted February 2, 2022 Style : default ( -1) : $LBS_SORT, $WS_BORDER, $WS_VSCROLL You should remove the sort if you want the last entry to be located at the end. “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...
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