angel83 Posted Monday at 04:26 AM Posted Monday at 04:26 AM Hello, greetings. I'm having a problem with the first column. When I use the horizontal bar, moving it to the right and back to the left slowly, the line in the first column is erased. I don't know what I'm doing wrong. this is code : expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GUIConstants.au3> #include <MsgBoxConstants.au3> #include <GuiComboBox.au3> #include <misc.au3> #include <WinAPITheme.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GUIConstants.au3> #include <MsgBoxConstants.au3> #include <GuiComboBox.au3> #include <misc.au3> #include <WinAPITheme.au3> #include <StaticConstants.au3> #include <GUIListBox.au3> #include <GUIConstants.au3> #include <TabConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> ;############################## #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GUIConstants.au3> #include <WINAPI.au3> #include <misc.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> ;######################################## #include <Array.au3> #include <File.au3> #include <GuiComboBox.au3> #include <GuiConstantsEx.au3> #include <GuiEdit.au3> #include <GuiListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Word.au3> #include <ListviewConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <GuiListView.au3> ;######################################## #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GuiTab.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <WinAPI.au3> #include <FontConstants.au3> Local $Form1 = GUICreate("Test", 1024, 768, -1, -1,BitOR($WS_MAXIMIZEBOX,$WS_TABSTOP,$WS_EX_TOPMOST));$WS_OVERLAPPEDWINDOW,$WS_CLIPCHILDREN GUISetBkColor(0xFFFFFF) Local $iLVStyle = BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS,$LVS_NOSORTHEADER) Local $iLVExtStyle = BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT) Local $hListView = GUICtrlCreateListView("#| NAME| PASSWORD| MAIL| CODE", 166, 281, 840, 455, $iLVStyle, $iLVExtStyle) GUICtrlSetFont($hListView, 12, 400, 0, "MS Sans Serif") GUICtrlSetResizing(-1,$GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOr($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT,$LVS_SORTDESCENDING,$LVS_SORTASCENDING)) _GuiCtrlListView_SetColumnWidth($hListView,0,40) _GuiCtrlListView_SetColumnWidth($hListView,1,890) _GuiCtrlListView_SetColumnWidth($hListView,2,890) _GuiCtrlListView_SetColumnWidth($hListView,3,890) _GuiCtrlListView_SetColumnWidth($hListView,4,890) _GUICtrlListView_SetBkColor($hListView, $CLR_BLACK) _GUICtrlListView_SetTextColor($hListView, $CLR_WHITE) _GUICtrlListView_SetTextBkColor($hListView, $CLR_BLACK) GUICtrlSetFont($hListView, 12, 700, 0, "MS Sans Serif") Local $OkButton = GUICtrlCreateButton("ADD DATA", 821, 21, 140, 38,$WS_BORDER) GUICtrlSetFont(-1, 18, 400, 0, "Impact") Local $Button206 = GUICtrlCreateButton("EXIT", 834, 77, 115, 38, $WS_BORDER) GUICtrlSetFont(-1, 18, 400, 0, "Impact") GUISetState(@SW_SHOW) While True Local $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit EndSwitch Select Case $msg =$OkButton _FillList() Case $msg =$Button206 exit EndSelect WEnd Func _FillList() Local $iRead = FileRead(@ScriptDir & "\Data\NAME DATA.ini") Local $iRead2 = FileRead(@ScriptDir & "\Data\PASSWORD DATA.ini") Local $iRead3 = FileRead(@ScriptDir & "\Data\MAIL DATA.ini") Local $iRead4 = FileRead(@ScriptDir & "\Data\CODE DATA.ini") Local $aString = StringSplit(StringStripCR($iRead), @LF) Local $aString2 = StringSplit(StringStripCR($iRead2), @LF) Local $aString3 = StringSplit(StringStripCR($iRead3), @LF) Local $aString4 = StringSplit(StringStripCR($iRead4), @LF) For $i = 1 To $aString[0] If $aString[$i] = "" Then ContinueLoop For $i = 1 To $aString2[0] If $aString2[$i] = "" Then ContinueLoop For $i = 1 To $aString3[0] If $aString3[$i] = "" Then ContinueLoop For $i = 1 To $aString4[0] If $aString4[$i] = "" Then ContinueLoop GUICtrlCreateListViewItem($i & "|" & StringRegExpReplace($aString[$i], "^.*\\", "") & "|" & StringRegExpReplace($aString2[$i], "(^.*\).*", "\1") & "|" & StringRegExpReplace($aString3[$i], "(^.*\).*", "\1")& "|" & StringRegExpReplace($aString4[$i], "(^.*\).*", "\1"), $hListView) Next Next Next Next Local $iLV_Width = 0 For $i = 0 To 4 GUICtrlSendMsg($hListView, $LVM_SETCOLUMNWIDTH, $i, $LVSCW_AUTOSIZE_USEHEADER) $iLV_Width += GUICtrlSendMsg($hListView, $LVM_GETCOLUMNWIDTH, $i, 0) Next EndFunc This is the file folder, they are just examples. Data.rar
angel83 Posted Wednesday at 02:46 AM Author Posted Wednesday at 02:46 AM GUICtrlSetFont($hListView, 12, 700, 0, "MS Sans Serif") if I change the thickness from 700 to 400 it works a little differently. I really don't know if there could be any way or example that could help me with this problem where the first horizontal line of column 0 disappears, (#)
ioa747 Posted Wednesday at 03:53 AM Posted Wednesday at 03:53 AM I also put an alternative one in case it suits you better I didn't encounter any problems with either the original or the alternative one expandcollapse popup#include <WindowsConstants.au3> #include <ListViewConstants.au3> #include <GUIConstantsEx.au3> #include <ColorConstants.au3> #include <GuiListView.au3> Local $Form1 = GUICreate("Test", 1024, 768, -1, -1, BitOR($WS_MAXIMIZEBOX, $WS_TABSTOP, $WS_EX_TOPMOST)) ;$WS_OVERLAPPEDWINDOW,$WS_CLIPCHILDREN GUISetBkColor(0xFFFFFF) Local $iLVStyle = BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER) Local $iLVExtStyle = BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT) Local $hListView = GUICtrlCreateListView("", 166, 281, 840, 455, $iLVStyle, $iLVExtStyle) ;~ Local $hListView = GUICtrlCreateListView("#| NAME| PASSWORD| MAIL| CODE", 166, 281, 840, 455, $iLVStyle, $iLVExtStyle) GUICtrlSetFont($hListView, 12, 400, 0, "MS Sans Serif") GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_SORTDESCENDING, $LVS_SORTASCENDING)) _GUICtrlListView_AddColumn($hListView, "#", 40) _GUICtrlListView_AddColumn($hListView, " NAME", 890) _GUICtrlListView_AddColumn($hListView, " PASSWORD", 890) _GUICtrlListView_AddColumn($hListView, " MAIL", 890) _GUICtrlListView_AddColumn($hListView, " CODE", 890) ;~ _GUICtrlListView_SetColumnWidth($hListView, 0, 40) ;~ _GUICtrlListView_SetColumnWidth($hListView, 1, 890) ;~ _GUICtrlListView_SetColumnWidth($hListView, 2, 890) ;~ _GUICtrlListView_SetColumnWidth($hListView, 3, 890) ;~ _GUICtrlListView_SetColumnWidth($hListView, 4, 890) _GUICtrlListView_SetBkColor($hListView, $CLR_BLACK) _GUICtrlListView_SetTextColor($hListView, $CLR_WHITE) _GUICtrlListView_SetTextBkColor($hListView, $CLR_BLACK) GUICtrlSetFont($hListView, 12, 700, 0, "MS Sans Serif") Local $OkButton = GUICtrlCreateButton("ADD DATA", 821, 21, 140, 38, $WS_BORDER) GUICtrlSetFont(-1, 18, 400, 0, "Impact") Local $Button206 = GUICtrlCreateButton("EXIT", 834, 77, 115, 38, $WS_BORDER) GUICtrlSetFont(-1, 18, 400, 0, "Impact") GUISetState(@SW_SHOW) While True Local $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE, $Button206 Exit Case $OkButton _FillList() EndSwitch WEnd Func _FillList() Local $iRead = FileRead(@ScriptDir & "\Data\NAME DATA.ini") Local $iRead2 = FileRead(@ScriptDir & "\Data\PASSWORD DATA.ini") Local $iRead3 = FileRead(@ScriptDir & "\Data\MAIL DATA.ini") Local $iRead4 = FileRead(@ScriptDir & "\Data\CODE DATA.ini") Local $aString = StringSplit(StringStripCR($iRead), @LF) Local $aString2 = StringSplit(StringStripCR($iRead2), @LF) Local $aString3 = StringSplit(StringStripCR($iRead3), @LF) Local $aString4 = StringSplit(StringStripCR($iRead4), @LF) For $i = 1 To $aString[0] If $aString[$i] = "" Then ContinueLoop For $i = 1 To $aString2[0] If $aString2[$i] = "" Then ContinueLoop For $i = 1 To $aString3[0] If $aString3[$i] = "" Then ContinueLoop For $i = 1 To $aString4[0] If $aString4[$i] = "" Then ContinueLoop GUICtrlCreateListViewItem($i & "|" & _ StringRegExpReplace($aString[$i], "^.*\\", "") & "|" & _ StringRegExpReplace($aString2[$i], "(^.*\).*", "\1") & "|" & _ StringRegExpReplace($aString3[$i], "(^.*\).*", "\1") & "|" & _ StringRegExpReplace($aString4[$i], "(^.*\).*", "\1"), $hListView) Next Next Next Next Local $iLV_Width = 0 For $i = 0 To 4 GUICtrlSendMsg($hListView, $LVM_SETCOLUMNWIDTH, $i, $LVSCW_AUTOSIZE_USEHEADER) $iLV_Width += GUICtrlSendMsg($hListView, $LVM_GETCOLUMNWIDTH, $i, 0) Next EndFunc ;==>_FillList  I know that I know nothing
pixelsearch Posted Wednesday at 03:31 PM Posted Wednesday at 03:31 PM On 8/4/2025 at 5:26 AM, angel83 said: When I use the horizontal bar, moving it to the right and back to the left slowly, the line in the first column is erased. I don't know what I'm doing wrong. What is this "horizontal bar" you're referring to ? If it is the vertical header separator, then maybe this is your problem : Entire column 0 (#) disappears after dragging the vertical separator to the very left. Now just drag it back to the right and column # will reappear. But I'm afraid it may not solve your issue, in case you're referring to something else. I know you wrote : 12 hours ago, angel83 said: [...] this problem where the first horizontal line of column 0 disappears, (#) But as you already wrote "horizontal" for "vertical" then I'm a bit perplexed... My suggestion : please show a pic of your listview, when your issue is visible. "I think you are searching a bug where there is no bug... don't listen to bad advice."
angel83 Posted Thursday at 02:20 AM Author Posted Thursday at 02:20 AM Hi, thanks ioa747 and pixelsearch for responding. Below is an image of my problem. Â The blue arrow: Indicates the problem where the column line disappears. The green arrow: Indicates the horizontal slider. If you slide it to the right until it stops and then slowly slide it to the left again, you'll see the line disappear..
Solution pixelsearch Posted Thursday at 05:39 AM Solution Posted Thursday at 05:39 AM (edited) @angel83 you did well posting a picture of the issue. I could reproduce your issue : there is a bad redrawing of the listview, when it got $LVS_EX_GRIDLINES in its extended styles. Now the vertical gridline can disappear momentarily when you scroll horizontally. I just found a very old thread (from 2007) where the issue was described. Now I just scripted a workaround which seems to help. It involves subclassing the listview scrollbars (which are child windows of the listview) but the result seems encouraging. On 8/4/2025 at 5:26 AM, angel83 said: When I use the horizontal scrollbar, moving it to the right and back to the left slowly, the vertical gridline in the first column is erased. My workaround is : when you release the mouse button from the scrollbar, then the listview is immediately redrawn and the vertical gridline reappears. If you absolutely want the vertical line to appear constantly while using the horizontal scrollbar, then it is possible but the listview will flicker because of too many redraws while scrolling. To keep it simple, I suggest to redraw the listview only once, when you release the mouse button from the scrollbar. The lines for subclassing the listview scrollbars are : #include <WinAPIShellEx.au3> ... Local $pListViewCallback = DllCallbackGetPtr(DllCallbackRegister("ListViewCallback", "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr")) _WinAPI_SetWindowSubclass(GUICtrlGetHandle($hListView), $pListViewCallback, 9999, 0) GUISetState(@SW_SHOW) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $Button206 ExitLoop Case $OkButton _FillList() EndSwitch WEnd _WinAPI_RemoveWindowSubclass(GUICtrlGetHandle($hListView), $pListViewCallback, 9999) ;============================================== Func ListViewCallback($hWnd, $iMsg, $wParam, $lParam, $iSubclassId, $pData) #forceref $iSubclassId, $pData Switch $iMsg Case $WM_HSCROLL ; , $WM_VSCROLL If BitAND($wParam, 0xFFFF) = 0x4 Then ; LoWord . $SB_THUMBPOSITION = 0x4 . Msdn : "the user has dragged the scroll box (thumb) and released the mouse button" _WinAPI_RedrawWindow($hWnd) EndIf EndSwitch Return _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>ListViewCallback Good luck Edited Thursday at 07:15 AM by pixelsearch typo angel83 1 "I think you are searching a bug where there is no bug... don't listen to bad advice."
pixelsearch Posted Thursday at 06:21 AM Posted Thursday at 06:21 AM (edited) 1 hour ago, pixelsearch said: If you absolutely want the vertical line to appear constantly while using the horizontal scrollbar, then it is possible but the listview will flicker because of too many redraws while scrolling. Good news I found a way to display the vertical line constantly while dragging the horizontal scrollbar, with very few flickering. To do this : 1) Add the extended style $LVS_EX_DOUBLEBUFFER to your line _GUICtrlListView_SetExtendedListViewStyle(...) 2) In the code of my preceding post, please change one line as indicated below : ; If BitAND($wParam, 0xFFFF) = 0x4 Then ; LoWord . $SB_THUMBPOSITION = 0x4 . Msdn : "the user has dragged the scroll box (thumb) and released the mouse button" If BitAND($wParam, 0xFFFF) = 0x5 Then ; LoWord . $SB_THUMBTRACK = 0x5 . Msdn : "the user is dragging the scroll box" Edited Thursday at 07:15 AM by pixelsearch typo angel83 and ioa747 1 1 "I think you are searching a bug where there is no bug... don't listen to bad advice."
angel83 Posted yesterday at 03:32 AM Author Posted yesterday at 03:32 AM Thank you so much, Pixelsearch. Your solution is fantastic. It worked wonders for me, and my problem was solved. I was desperate after trying so many things and nothing. I really appreciate your help, Pixelsearch. pixelsearch 1
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