lucio69f Posted November 17, 2023 Share Posted November 17, 2023 Hi , i try to understund this function _GUICtrlListView_GetItemParam i modify the example scritp , but i dont understund a mecanism about it #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> Example() Func Example() GUICreate("ListView Get/Set Item Param (v" & @AutoItVersion & ")", 400, 300) Local $idListView = GUICtrlCreateListView("", 2, 2, 394, 268) GUISetState(@SW_SHOW) ; Add columns _GUICtrlListView_AddColumn($idListView, "Items", 100) ; Add items _GUICtrlListView_AddItem($idListView, "Item 0") _GUICtrlListView_AddItem($idListView, "Item 1") _GUICtrlListView_AddItem($idListView, "Item 2") ; Set item 1 parameter ;_GUICtrlListView_SetItemParam($idListView, 1, 1234) MsgBox($MB_SYSTEMMODAL, "Information", "Item 1 Parameter: " & _GUICtrlListView_GetItemParam($idListView, 1)) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example i suppose i must return if set 1 in _GUICtrlListView_GetItemParam(........., 1) in message box must appear Item 1 , but return 0 , why ??? thanks at all Link to comment Share on other sites More sharing options...
Andreik Posted November 17, 2023 Share Posted November 17, 2023 (edited) Because you never set the item param, at least not directly. Fourth parameter of _GUICtrlListView_AddItem() is exactly this param and by default is set to 0 so this is the value that you get when you use _GUICtrlListView_GetItemParam() unless you set another value for this parameter or if you set the param later. Edited November 17, 2023 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
lucio69f Posted November 17, 2023 Author Share Posted November 17, 2023 continue to not understund sorry Link to comment Share on other sites More sharing options...
Andreik Posted November 17, 2023 Share Posted November 17, 2023 What part? If you don't set something you don't have it, it's zero. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
argumentum Posted November 18, 2023 Share Posted November 18, 2023 (edited) ..that "parameter" is an integer used like a note. You can read the note/param and do stuff based on that parameter. Change font/colors/etc. . So you'd assign a parameter for your use. Is upto you ( your code ) to do something with it or not. That's why by default is just zero. That should make sense as a non-programmer. NOTE: do read the remarks https://www.autoitscript.com/autoit3/docs/libfunctions/_GUICtrlListView_SetItemParam.htm Look at https://www.autoitscript.com/forum/topic/89654-listview-for-every-subitem-set-color-backcol-and-font/ to see how it's used there. Edited November 18, 2023 by argumentum clarify Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
lucio69f Posted November 18, 2023 Author Share Posted November 18, 2023 11 hours ago, argumentum said: ..that "parameter" is an integer used like a note. You can read the note/param and do stuff based on that parameter. Change font/colors/etc. . So you'd assign a parameter for your use. Is upto you ( your code ) to do something with it or not. That's why by default is just zero. That should make sense as a non-programmer. trhanks now i understund çD is only anote mmmm Link to comment Share on other sites More sharing options...
lucio69f Posted November 18, 2023 Author Share Posted November 18, 2023 but why not colored? #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> Example() Func Example() GUICreate("ListView Get/Set Item Param (v" & @AutoItVersion & ")", 400, 300) Local $idListView = GUICtrlCreateListView("", 2, 2, 394, 268) GUISetState(@SW_SHOW) ; Add columns _GUICtrlListView_AddColumn($idListView, "Items", 100) ; Add items _GUICtrlListView_AddItem($idListView, "Item 0",-1,3) _GUICtrlListView_AddItem($idListView, "Item 1") _GUICtrlListView_AddItem($idListView, "Item 2") ; Set item 1 parameter ;_GUICtrlListView_SetItemParam($idListView, 1, 1234) Local $ctrlID = _GUICtrlListView_GetItemParam($idListView, 3) GUICtrlSetBkColor($ctrlID, 0xCC7722) MsgBox($MB_SYSTEMMODAL, "Information", "Item 1 Parameter: " & _GUICtrlListView_GetItemParam($idListView, 0)) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Link to comment Share on other sites More sharing options...
Andreik Posted November 18, 2023 Share Posted November 18, 2023 (edited) 47 minutes ago, lucio69f said: trhanks now i understund çD is only anote mmmm No, you don't. First of all you assigned the value 3 as param for the first item (0 based index) of the list view but you read the param value of the 4th item (0 based index) which is still zero because it doesn't even exists. And even if you would get the param value for the first item, the value 3 used with GUICtrlSetBkolor() doesn't make any sense because what you read it's not a control ID, maybe just by chance. Edited November 18, 2023 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Nine Posted November 18, 2023 Share Posted November 18, 2023 (edited) 54 minutes ago, lucio69f said: but why not colored? Because with your way, you can only color the whole listview, not individual cells. I already showed you how simple it is to do it in a previous post, remember ? Edited November 18, 2023 by Nine “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...
lucio69f Posted November 19, 2023 Author Share Posted November 19, 2023 10 hours ago, Andreik said: No, you don't. First of all you assigned the value 3 as param for the first item (0 based index) of the list view but you read the param value of the 4th item (0 based index) which is still zero because it doesn't even exists. And even if you would get the param value for the first item, the value 3 used with GUICtrlSetBkolor() doesn't make any sense because what you read it's not a control ID, maybe just by chance. but you tell me the number 3 is only anote and i must use this not for call a line , why tell now is 0 ??? Link to comment Share on other sites More sharing options...
lucio69f Posted November 19, 2023 Author Share Posted November 19, 2023 continue to not understund sorry why this code work #include <GUIConstantsEx.au3> #include <GuiListView.au3> GUICreate("listview items", 220, 250, 100, 200) Local $idListview = GUICtrlCreateListView("col1 |col2|col3 ", 10, 10, 200, 230) For $i = 1 to 10 GUICtrlCreateListViewItem("item" & $i & "|col" & $i & "2|col" & $i & "3", $idListview) Next LVBK ($idListview, 2, 0x00ff00) LVBK ($idListview, 5, 0x00ff00) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func LVBK ($ListView, $row, $color) GUICtrlSetBkColor (_GUICtrlListView_GetItemParam($ListView, $row),$color) EndFunc and this code not work ? #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> Example() Func Example() GUICreate("ListView Get/Set Item Param (v" & @AutoItVersion & ")", 400, 300) Local $idListView = GUICtrlCreateListView("", 2, 2, 394, 268) GUISetState(@SW_SHOW) ; Add columns _GUICtrlListView_AddColumn($idListView, "Items", 100) ; Add items _GUICtrlListView_AddItem($idListView, "Item 0") _GUICtrlListView_AddItem($idListView, "Item 1") _GUICtrlListView_AddItem($idListView, "Item 2") ; Set item 1 parameter LVBK ($idListView, 0, 0x00ff00) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Func LVBK ($ListView, $row, $color) GUICtrlSetBkColor (_GUICtrlListView_GetItemParam($ListView, $row),$color) EndFunc Link to comment Share on other sites More sharing options...
argumentum Posted November 19, 2023 Share Posted November 19, 2023 1 hour ago, lucio69f said: continue to not understund sorry why this code work On 11/17/2023 at 8:22 PM, argumentum said: NOTE: do read the remarks https://www.autoitscript.com/autoit3/docs/libfunctions/_GUICtrlListView_SetItemParam.htm Look at https://www.autoitscript.com/forum/topic/89654-listview-for-every-subitem-set-color-backcol-and-font/ to see how it's used there. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
lucio69f Posted November 19, 2023 Author Share Posted November 19, 2023 i notice if i use GUICtrlCreateListViewItem("item" & $i & "|col" & $i & "2|col" & $i & "3", $idListview) is work but if i use _GUICtrlListView_AddColumn($idListView, "Items", 100) ; Add items _GUICtrlListView_AddItem($idListView, "Item 0",-1,3) _GUICtrlListView_AddItem($idListView, "Item 1") _GUICtrlListView_AddItem($idListView, "Item 2") not work , now the question is : is not possible to use because _GUICtrlListView_AddItem use another principle or is possible to use also with _GUICtrlListView_AddItem but i am ignore the the mode to use t ? Link to comment Share on other sites More sharing options...
lucio69f Posted November 19, 2023 Author Share Posted November 19, 2023 9 hours ago, argumentum said: On 11/18/2023 at 2:22 AM, argumentum said: NOTE: do read the remarks https://www.autoitscript.com/autoit3/docs/libfunctions/_GUICtrlListView_SetItemParam.htm Look at https://www.autoitscript.com/forum/topic/89654-listview-for-every-subitem-set-color-backcol-and-font/ to see how it's used there. is very complicated like example with dllsctrucutere and much more , i am not professionist programmer sorry Link to comment Share on other sites More sharing options...
Andreik Posted November 19, 2023 Share Posted November 19, 2023 10 hours ago, lucio69f said: continue to not understund sorry why this code work #include <GUIConstantsEx.au3> #include <GuiListView.au3> GUICreate("listview items", 220, 250, 100, 200) Local $idListview = GUICtrlCreateListView("col1 |col2|col3 ", 10, 10, 200, 230) For $i = 1 to 10 GUICtrlCreateListViewItem("item" & $i & "|col" & $i & "2|col" & $i & "3", $idListview) Next LVBK ($idListview, 2, 0x00ff00) LVBK ($idListview, 5, 0x00ff00) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func LVBK ($ListView, $row, $color) GUICtrlSetBkColor (_GUICtrlListView_GetItemParam($ListView, $row),$color) EndFunc and this code not work ? #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> Example() Func Example() GUICreate("ListView Get/Set Item Param (v" & @AutoItVersion & ")", 400, 300) Local $idListView = GUICtrlCreateListView("", 2, 2, 394, 268) GUISetState(@SW_SHOW) ; Add columns _GUICtrlListView_AddColumn($idListView, "Items", 100) ; Add items _GUICtrlListView_AddItem($idListView, "Item 0") _GUICtrlListView_AddItem($idListView, "Item 1") _GUICtrlListView_AddItem($idListView, "Item 2") ; Set item 1 parameter LVBK ($idListView, 0, 0x00ff00) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Func LVBK ($ListView, $row, $color) GUICtrlSetBkColor (_GUICtrlListView_GetItemParam($ListView, $row),$color) EndFunc Because you fail to understand basic programming and you reject what other people already told you. In the second example _GUICtrlListView_GetItemParam() will return 0 no matter what index you will use because you never set param. Since this function will always return 0 and this value it's passed to GUICtrlSetBkColor() as control ID it's clear that won't work. Even if you would have set the param it would still not work because _GUICtrlListView_AddItem() does not return a control ID and GUICtrlSetBkColor() works just for controls returned by GUICtrlCreateListViewItem() and @Nine already told you that if you want to color items using GuiListView UDF you have to redraw the control by yourself. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
lucio69f Posted November 19, 2023 Author Share Posted November 19, 2023 but i set a param with 3 _GUICtrlListView_AddItem($idListView, "Item 0",-1,3) Link to comment Share on other sites More sharing options...
Andreik Posted November 19, 2023 Share Posted November 19, 2023 Look at the posted code, you didn't. But even if it's set it won't work because the value 3 doesn't mean anything. Maybe by chance it's the control ID of some control. This was already told you few times but you don't listen. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
lucio69f Posted November 19, 2023 Author Share Posted November 19, 2023 On 11/18/2023 at 3:07 PM, Nine said: Because with your way, you can only color the whole listview, not individual cells. I already showed you how simple it is to do it in a previous post, remember ? i saw but is possible do it wihtout WM_NOTIFY ??? is very complicate the paradigm WM_NOTIFY Link to comment Share on other sites More sharing options...
lucio69f Posted November 19, 2023 Author Share Posted November 19, 2023 Just now, Andreik said: Look at the posted code, you didn't. But even if it's set it won't work because the value 3 doesn't mean anything. Maybe by chance it's the control ID of some control. This was already told you few times but you don't listen. but how can set it ?? i saw manual and tell insert number Link to comment Share on other sites More sharing options...
Andreik Posted November 19, 2023 Share Posted November 19, 2023 (edited) Set what? What are you trying to do? #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> Example() Func Example() GUICreate("ListView Get/Set Item Param (v" & @AutoItVersion & ")", 400, 300) Local $idListView = GUICtrlCreateListView("", 2, 2, 394, 268) GUISetState(@SW_SHOW) ; Add columns _GUICtrlListView_AddColumn($idListView, "Items", 100) ; Add items _GUICtrlListView_AddItem($idListView, "Item 0", -1, 3) _GUICtrlListView_AddItem($idListView, "Item 1") _GUICtrlListView_AddItem($idListView, "Item 2") For $Index = 0 To _GUICtrlListView_GetItemCount($idListView) - 1 ConsoleWrite('Param value of item ' & $Index & ' is: ' & _GUICtrlListView_GetItemParam($idListView, $Index) & @CRLF) Next Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Your problem is not to set/get param but what it means what you set as param. The value 3 set as param for first item of list view doesn't mean anything, it's just a value, it's not a control ID so you cannot use it with GUICtrlSetBkColor(). Is that simple. Edited November 19, 2023 by Andreik When the words fail... music speaks. 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