taietel Posted July 25, 2010 Share Posted July 25, 2010 (edited) Is there any possibility to hide the listview vertical scrollbar, but be able to scroll? I've tried something with a listbox (the script below), but a listview gives more options (icons, multiple columns etc.):expandcollapse popup#include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $hForm1, $hForm2, $hPic $hForm1 = GUICreate("Form1", 150, 200,-1,-1,BitOR($WS_SYSMENU, $WS_POPUP), $WS_EX_LAYERED) GUISetBkColor(0x000000) $ListB = GUICtrlCreateList("", 10, 10, 130, 180, BitOR($LBS_NOTIFY,$LBS_SORT,$WS_BORDER), 0) For $i = 1 To 50 GUICtrlSetData(-1, "Line" & $i) Next GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetColor(-1, 0xFFCC00) GUICtrlSetBkColor(-1,0x222222) $hPic = GUICtrlCreatePic("", 100, 10, 50, 180) WinSetTrans($hForm1,"",200) GUISetState() $pos1=WinGetPos($hForm1) $hForm2 = GUICreate("Form2", 25, 49, $pos1[0]+$pos1[2]-40, $pos1[1]+60, BitOR($WS_SYSMENU,$WS_POPUP), $WS_EX_LAYERED) GUISetBkColor(0x000000) $hUp = GUICtrlCreateIcon(@ScriptDir & "\up.ico", -1, 4, 4, 16, 16) GUICtrlSetCursor($hUp,0) GUICtrlSetTip($hUp,"Up") $hDown = GUICtrlCreateIcon(@ScriptDir & "\down.ico", -1, 4, 28, 16, 16) GUICtrlSetCursor($hDown,0) GUICtrlSetTip($hDown,"Down") GUICtrlCreatePic("", 0, 0, 24, 48) WinSetTrans($hForm2,"",50) GUISetState(@SW_HIDE, $hForm2) While 1 Sleep(10) Local $mcur = GUIGetCursorInfo($hForm1) If $mcur[4] = $hPic then GUISetState(@SW_SHOW, $hForm2) Else GUISetState(@SW_HIDE, $hForm2) EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GuiDelete() Exit Case $hDown While 1 Sleep (10) Local $ind = _GUICtrlListBox_GetCurSel($ListB) _GUICtrlListBox_SetCurSel($ListB,$ind+5) ExitLoop WEnd Case $hUp While 1 Sleep (10) Local $ind = _GUICtrlListBox_GetCurSel($ListB) If $ind<5 Then _GUICtrlListBox_SetCurSel($ListB,0) _GUICtrlListBox_SetCurSel($ListB,$ind-5) ExitLoop WEnd EndSwitch WEndWhen you move the mouse over the right part of the listbox, it will appear a customized scrollbar that works with the listbox... Any chance with a listview? I've searched (and read and still do), but I didn't figure this out.I've attached the icons used in the script, to see what I mean.Thanks in advance! (for pointing me in the right direction) Screenshot of the listbox eith the customized scrollbar: Edited July 26, 2010 by taietel Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text Link to comment Share on other sites More sharing options...
taietel Posted July 26, 2010 Author Share Posted July 26, 2010 Solved (dirty way: listview width > gui width): Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text Link to comment Share on other sites More sharing options...
Belini Posted March 8, 2012 Share Posted March 8, 2012 Remove the vertical bar of the listview: expandcollapse popup#include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiScrollBars.au3> #include <ScrollBarConstants.au3> Global $hGui, $hListView, $hList, $iDLLUser32 = DllOpen("user32.dll") Global $wProcNewLV, $wProcOldLV $hGui = GUICreate("Scrollable ListView/ListBox without scrollbars", 300, 120, -1, -1) Local $cListView = GUICtrlCreateListView("", 2, 2, 296, 100) Local $exStyles = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER) $hListView = GUICtrlGetHandle($cListView) tira_barra($cListView) ; Add columns _GUICtrlListView_InsertColumn($cListView, 0, "Column 1", 100) _GUICtrlListView_InsertColumn($cListView, 1, "Column 2", 100) ; Add items _GUICtrlListView_AddItem($cListView, "Row 1: Col 1") _GUICtrlListView_AddItem($cListView, "Row 2: Col 1") _GUICtrlListView_AddItem($cListView, "Row 3: Col 1") _GUICtrlListView_AddItem($cListView, "Row 4: Col 1") _GUICtrlListView_AddItem($cListView, "Row 6: Col 1") _GUICtrlListView_AddItem($cListView, "Row 7: Col 1") GUISetState() GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _Exit() Func tira_barra($cListView) $wProcNewLV = DllCallbackRegister("_LVWndProc", "ptr", "hwnd;uint;wparam;lparam") $wProcOldLV = _WinAPI_SetWindowLong($hListView, $GWL_WNDPROC, DllCallbackGetPtr($wProcNewLV)) EndFunc ;==>tira_barra Func _Exit() If $wProcOldLV Then _WinAPI_SetWindowLong($hListView, $GWL_WNDPROC, $wProcOldLV) GUIDelete($hGui);prevents crash on exit caused by DllCallbackFree() DllClose($iDLLUser32) Exit EndFunc ;==>_Exit Func _LVWndProc($hWnd, $Msg, $wParam, $lParam) #forceref $hWnd, $Msg, $wParam, $lParam Switch $Msg Case $WM_NCCALCSIZE _RemoveVHScroll($hWnd) Case $WM_WINDOWPOSCHANGING Local $tWINDOWPOS = DllStructCreate($tagWINDOWPOS, $lParam) ;uncomment for mouse scrolling - no mouse scrolling without, but border is not erased (vertical key scrolling flickers visibly)) DllStructSetData($tWINDOWPOS, "Flags", _ BitAND(DllStructGetData($tWINDOWPOS, "Flags"), BitNOT($SWP_FRAMECHANGED))) EndSwitch ;pass the unhandled messages to default WindowProc Local $aResult = DllCall($iDLLUser32, "lresult", "CallWindowProcW", "ptr", _ $wProcOldLV, "hwnd", $hWnd, "uint", $Msg, "wparam", $wParam, "lparam", $lParam) If @error Then Return -1 Return $aResult[0] EndFunc ;==>_LVWndProc Func _RemoveVHScroll($hWnd) Local $iLVStyle = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE) $iLVStyle = BitAND($iLVStyle, BitNOT($WS_VSCROLL)) $iLVStyle = BitAND($iLVStyle, BitNOT($WS_HSCROLL)) _WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $iLVStyle) EndFunc ;==>_RemoveVHScroll My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
rover Posted March 9, 2012 Share Posted March 9, 2012 Remove the vertical bar of the listview: expandcollapse popup#include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiScrollBars.au3> #include <ScrollBarConstants.au3> Global $hGui, $hListView, $hList, $iDLLUser32 = DllOpen("user32.dll") Global $wProcNewLV, $wProcOldLV $hGui = GUICreate("Scrollable ListView/ListBox without scrollbars", 300, 120, -1, -1) Local $cListView = GUICtrlCreateListView("", 2, 2, 296, 100) Local $exStyles = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER) $hListView = GUICtrlGetHandle($cListView) tira_barra($cListView) ; Add columns _GUICtrlListView_InsertColumn($cListView, 0, "Column 1", 100) _GUICtrlListView_InsertColumn($cListView, 1, "Column 2", 100) ; Add items _GUICtrlListView_AddItem($cListView, "Row 1: Col 1") _GUICtrlListView_AddItem($cListView, "Row 2: Col 1") _GUICtrlListView_AddItem($cListView, "Row 3: Col 1") _GUICtrlListView_AddItem($cListView, "Row 4: Col 1") _GUICtrlListView_AddItem($cListView, "Row 6: Col 1") _GUICtrlListView_AddItem($cListView, "Row 7: Col 1") GUISetState() GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _Exit() Func tira_barra($cListView) $wProcNewLV = DllCallbackRegister("_LVWndProc", "ptr", "hwnd;uint;wparam;lparam") $wProcOldLV = _WinAPI_SetWindowLong($hListView, $GWL_WNDPROC, DllCallbackGetPtr($wProcNewLV)) EndFunc ;==>tira_barra Func _Exit() If $wProcOldLV Then _WinAPI_SetWindowLong($hListView, $GWL_WNDPROC, $wProcOldLV) GUIDelete($hGui);prevents crash on exit caused by DllCallbackFree() DllClose($iDLLUser32) Exit EndFunc ;==>_Exit Func _LVWndProc($hWnd, $Msg, $wParam, $lParam) #forceref $hWnd, $Msg, $wParam, $lParam Switch $Msg Case $WM_NCCALCSIZE _RemoveVHScroll($hWnd) Case $WM_WINDOWPOSCHANGING Local $tWINDOWPOS = DllStructCreate($tagWINDOWPOS, $lParam) ;uncomment for mouse scrolling - no mouse scrolling without, but border is not erased (vertical key scrolling flickers visibly)) DllStructSetData($tWINDOWPOS, "Flags", _ BitAND(DllStructGetData($tWINDOWPOS, "Flags"), BitNOT($SWP_FRAMECHANGED))) EndSwitch ;pass the unhandled messages to default WindowProc Local $aResult = DllCall($iDLLUser32, "lresult", "CallWindowProcW", "ptr", _ $wProcOldLV, "hwnd", $hWnd, "uint", $Msg, "wparam", $wParam, "lparam", $lParam) If @error Then Return -1 Return $aResult[0] EndFunc ;==>_LVWndProc Func _RemoveVHScroll($hWnd) Local $iLVStyle = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE) $iLVStyle = BitAND($iLVStyle, BitNOT($WS_VSCROLL)) $iLVStyle = BitAND($iLVStyle, BitNOT($WS_HSCROLL)) _WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $iLVStyle) EndFunc ;==>_RemoveVHScroll It's unfinished code and does not address several issues. Next time try linking to the original post and/or accrediting the author. ListView without ScrollBar ? I see fascists... Link to comment Share on other sites More sharing options...
Belini Posted March 9, 2012 Share Posted March 9, 2012 the code was posted in another forum that did not include the author's name, I'll pay more attention going forward. My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ 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