Jump to content

Search the Community

Showing results for tags 'scrollbars'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 4 results

  1. I check this snippet: https://www.autoitscript.com/wiki/Snippets_(_GUI_)#GUI_With_Scrollable_TabItem Modified them and I refactored. That's because I needed to adapt it to my needs (I'll write later). I thought I understood how it works. But I was wrong. This is my example which is showing what I want to achieve. #include <AutoItConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GuiScrollBars.au3> #include <GUIScrollbars_Ex.au3> #include <StringConstants.au3> #include <StructureConstants.au3> #include <WindowsConstants.au3> GUIRegisterMsg($WM_VSCROLL, WM_VSCROLL) _Example() Func _Example() Local $i_Count = 30 Local $a_Options_List[$i_Count + 1] $a_Options_List[0] = $i_Count For $i = 1 To $i_Count $a_Options_List[$i] = 'Test #' & $i Next ConsoleWrite("- " & _my_gui_Wybierz('Testing', $a_Options_List) & @CRLF) EndFunc ;==>_Example Func _my_gui_Wybierz($s_Description, $a_Options_List = "", $i_Left = Default, $i_Top = Default, $i_Width = Default, $hWnd_Parent = 0) ;~ WinSetOnTop($ACROBAT_TITLE, "", $WINDOWS_NOONTOP ) If $i_Left = Default Then $i_Left = -1 If $i_Top = Default Then $i_Top = -1 If $i_Width = Default Then $i_Width = 400 #Region _my_gui_Wybierz - GUI Creation Local $i_Height = 600 Local $hWND_DateForm = GUICreate("", $i_Width, $i_Height, $i_Left, $i_Top, BitOR(0, $WS_SIZEBOX), -1, $hWnd_Parent) WinSetOnTop($hWND_DateForm, "", $WINDOWS_ONTOP) Local $hChild = GUICreate("Scroll area", $i_Width - 15, $i_Height - 40, 0, 0, $WS_POPUP, $WS_EX_MDICHILD, $hWND_DateForm) _GUIScrollBars_Init($hChild, -1) _GUIScrollBars_ShowScrollBar($hChild, $SB_HORZ, False) _GUIScrollBars_ShowScrollBar($hChild, $SB_VERT, True) ;~ _GUIScrollBars_SetScrollRange($hChild, $SB_VERT, 3, 30) GUICtrlCreateLabel("", 10, 7, $i_Width - 45, 80) Local $id_Label1 = GUICtrlCreateLabel("", 10, 7 + 5, $i_Width - 45, 80 - 5) GUICtrlSetBkColor(-1, 0x88AABB) Local $a_List_of_Button_ID[$a_Options_List[0] + 1] For $IDX_Item = 1 To $a_Options_List[0] If $IDX_Item > 0 And $IDX_Item < 10 Then $a_List_of_Button_ID[$IDX_Item] = GUICtrlCreateButton( _ $IDX_Item & ". " & $a_Options_List[$IDX_Item], _ 10, 90 + ($IDX_Item - 1) * 21, $i_Width - 45, 20, BitOR($BS_LEFT, $WS_GROUP)) Else $a_List_of_Button_ID[$IDX_Item] = GUICtrlCreateButton( _ Chr(Asc('A') + $IDX_Item - 10) & ". " & $a_Options_List[$IDX_Item], _ 10, 90 + ($IDX_Item - 1) * 21, $i_Width - 45, 20, BitOR($BS_LEFT, $WS_GROUP)) EndIf Next Local $temp_var = $a_Options_List[0] Local $a_accelerators[($temp_var * 2) + 1][2] Local $i_Accelerators_Counter = 0 Local $i_Accelerator_Char1 = '' Local $i_Accelerator_Char2 = '' For $IDX_Item = 1 To $a_Options_List[0] If $IDX_Item > 9 Then $i_Accelerator_Char1 = Chr(Asc('A') + $IDX_Item - 10) $i_Accelerator_Char2 = Chr(Asc('a') + $IDX_Item - 10) Else $i_Accelerator_Char1 = "{NUMPAD" & $IDX_Item & "}" ;Chr(48 + $IDX_Item) $i_Accelerator_Char2 = $IDX_Item EndIf $a_accelerators[($IDX_Item * 2) - 1][0] = $i_Accelerator_Char1 $a_accelerators[($IDX_Item * 2) - 1][1] = $a_List_of_Button_ID[$IDX_Item] $a_accelerators[($IDX_Item * 2) - 1 + 1][0] = $i_Accelerator_Char2 $a_accelerators[($IDX_Item * 2) - 1 + 1][1] = $a_List_of_Button_ID[$IDX_Item] $i_Accelerators_Counter += 2 Next $a_accelerators[0][0] = $i_Accelerators_Counter GUISetAccelerators($a_accelerators, $hChild) GUICtrlSetData($id_Label1, $s_Description) GUISetState(@SW_SHOW, $hWND_DateForm) GUISetState(@SW_SHOW, $hChild) #EndRegion _my_gui_Wybierz - GUI Creation #Region - _my_gui_Wybierz - Handling messages Local $i_Selected_item = 0 Local $v_Return_Value = "" Local $a_GUI_Messages While 1 $a_GUI_Messages = GUIGetMsg($GUI_EVENT_ARRAY) If $a_GUI_Messages[0] = $GUI_EVENT_NONE Then ; do nothing ElseIf $a_GUI_Messages[1] = $hWND_DateForm Then If $a_GUI_Messages[0] = $GUI_EVENT_CLOSE Then ExitLoop ElseIf $a_GUI_Messages[1] <> $hChild Then ; .... Else For $IDX_Check = 1 To $a_Options_List[0] If $a_List_of_Button_ID[$IDX_Check] = $a_GUI_Messages[0] Then $v_Return_Value = GUICtrlRead($a_List_of_Button_ID[$IDX_Check]) $i_Selected_item = $IDX_Check $v_Return_Value = _RegExpFirstMatch($v_Return_Value, '.+?\. (.+)') ExitLoop 2 ; exit from ForNext and also from WhileWend EndIf Next EndIf WEnd #EndRegion - _my_gui_Wybierz - Handling messages GUIDelete($hChild) GUIDelete($hWND_DateForm) Return SetError(0, $i_Selected_item, $v_Return_Value) EndFunc ;==>_my_gui_Wybierz Func WM_VSCROLL($hWnd, $msg, $wParam, $lParam) #forceref $msg, $wParam, $lParam Local $nScrollCode = BitAND($wParam, 0x0000FFFF) Local $index = -1, $yChar, $yPos Local $Min, $Max, $Page, $Pos, $TrackPos For $x = 0 To UBound($aSB_WindowInfo) - 1 If $aSB_WindowInfo[$x][0] = $hWnd Then $index = $x $yChar = $aSB_WindowInfo[$index][3] ExitLoop EndIf Next If $index = -1 Then Return 0 ; Get all the vertial scroll bar information Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT) $Min = DllStructGetData($tSCROLLINFO, "nMin") $Max = DllStructGetData($tSCROLLINFO, "nMax") $Page = DllStructGetData($tSCROLLINFO, "nPage") ; Save the position for comparison later on $yPos = DllStructGetData($tSCROLLINFO, "nPos") $Pos = $yPos $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos") Switch $nScrollCode Case $SB_TOP ; user clicked the HOME keyboard key DllStructSetData($tSCROLLINFO, "nPos", $Min) Case $SB_BOTTOM ; user clicked the END keyboard key DllStructSetData($tSCROLLINFO, "nPos", $Max) Case $SB_LINEUP ; user clicked the top arrow DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1) Case $SB_LINEDOWN ; user clicked the bottom arrow DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1) Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page) Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page) Case $SB_THUMBTRACK ; user dragged the scroll box DllStructSetData($tSCROLLINFO, "nPos", $TrackPos) EndSwitch ; Set the position and then retrieve it. Due to adjustments ; by Windows it may not be the same as the value set. DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS) _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO) _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO) ; If the position has changed, scroll the window and update it $Pos = DllStructGetData($tSCROLLINFO, "nPos") If ($Pos <> $yPos) Then _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos)) $yPos = $Pos EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_VSCROLL Func _RegExpFirstMatch($s_Data, $s_Pattern) Local $a_Results = StringRegExp($s_Data, $s_Pattern, $STR_REGEXPARRAYGLOBALMATCH) If @error Then Return SetError(@error, @extended, '') Return SetError(0, UBound($a_Results), $a_Results[0]) EndFunc ;==>_RegExpFirstMatch I have few problems with this code, and many question related to them. Question 1: How to make the Scrollbars to work ? I mean to scroll buttons. Question 2: Do I must to ues Child Window, or is it possible to scroll buttons without using Child Window ? Question 3: Why after uncommenting this following line: ;~ _GUIScrollBars_SetScrollRange($hChild, $SB_VERT, 3, 30) the ScrollBar disapears ?
  2. I'm trying to implement a scrolling list of controls. I have it sort of working using the GUIScrollBars_Ex UDF by @Melba23 found here. I also want to be able to tab through the controls, which I have accomplished by adding $WS_EX_CONTROLPARENT to the child GUI. The problem is that with that style applied, the scrollbar doesn't act like a scrollbar, instead it acts as a title bar to the child GUI letting you drag the it around (and you can even "maximize" it by double clicking). Any ideas? #include <GUIConstants.au3> #include "GUIScrollbars_Ex.au3" $iButtonCount = 30 $hParent = GUICreate('Example', 300, 230) $hChild = GUICreate('', 300, 200, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP), $WS_EX_CONTROLPARENT, $hParent) For $i = 0 To $iButtonCount GUICtrlCreateButton('Button in list', 0, $i*30, 300, 30) Next GUISwitch($hParent) GUICtrlCreateButton('More Buttons', 0, 200, 150, 30) GUICtrlCreateButton('More Buttons', 150, 200, 150, 30) GUISetState(@SW_SHOW, $hParent) GUISetState(@SW_SHOW, $hChild) _GUIScrollbars_Generate($hChild, 100, $iButtonCount * 30+20) While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd
  3. I have a GUI with a parent window that has a menu and shortcut buttons at the top, and a child window which displays a list which is scrolled vertically. When the list is relatively small, like no more than 100 or so lines then it scrolls fine. As the list gets larger, scrolling begins to slow, and if you start mixing up the scroll method (mousewheel, left-clicking the scrollbar box, etc) then it begins to hang. When it hangs, dwm.exe CPU usage maxes out, and I can't even switch to another window. Each line in the list is 1000px wide X 30px tall, and the lines alternate between a gray background and a white background, in case that matters. When a non-Aero theme is active, everything works fine. So, I could disable DWM every time someone fires it up, but changing a client's color scheme is not ideal. I tried to utilize _WinAPI_DwmSetWindowAttribute($oGui_Parent, $DWMWA_NCRENDERING_POLICY, $DWMNCRP_DISABLED), and although it succeeds in disabling DWM for that window, it doesn't seem to make any difference as far as the scrolling lag is concerned. The code is several thousand lines long and contains proprietary information, so I'm trying to avoid posting that, but these are the lines which are creating the GUIs. Is there anything that anyone can think of off the top of their heads, or is there anything jumping out at you from this snippet of code? Any help is appreciated! $oGui_Parent = GUICreate("Data Viewer", 700, 500, Default, Default, BitOR($WS_CAPTION, $WS_MINIMIZEBOX, $WS_POPUPWINDOW)) WinSetTrans($oGui_Parent, "", 255) _WinAPI_DwmSetWindowAttribute($oGui_Parent, $DWMWA_NCRENDERING_POLICY, $DWMNCRP_DISABLED) GUISetFont(9, 500, 0, "Calibri") GUISetBkColor(0xFFFFFF) $oGui_Child = GUICreate("", 700, 400, 0, 100, $WS_POPUP, $WS_EX_MDICHILD, $oGui_Parent) WinSetTrans($oGui_Child, "", 255) _WinAPI_DwmSetWindowAttribute($oGui_Child, $DWMWA_NCRENDERING_POLICY, $DWMNCRP_DISABLED) GUISetFont(9, 500, 0, "Calibri") GUISetBkColor(0xFFFFFF)
  4. Any idea how to create this GUI example without using a child GUI? #include <constants.au3> #include <guirebar.au3> #include <guiscrollbars.au3> #include <guitoolbar.au3> #include <screencapture.au3> #include <scrollbarconstants.au3> #include <windowsconstants.au3> Global Enum $idNew = 1000, $idOpen, $idSave, $idHelp Global Const $iImageW = @DesktopWidth, $iImageH = @DesktopHeight Global Const $hBMP_ScreenCapture = _ScreenCapture_Capture("", 0, 0, $iImageW, $iImageH) Global Const $iW = 800, $iH = 600 Global Const $hGUI = GUICreate("Test", $iW, $iH) Global Const $hToolbar = _GUICtrlToolbar_Create($hGUI) Global Const $hReBar = _GUICtrlRebar_Create($hGUI, BitOR($CCS_TOP, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS)) Global Const $height_delta = 38 Global Const $hGUI_Child = GUICreate("", $iW, $iH - $height_delta, 0, $height_delta, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) Global Const $idPic = GUICtrlCreatePic("", 0, 0, $iImageW, $iImageH) _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR) _GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW) _GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN) _GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE) _GUICtrlToolbar_AddButtonSep($hToolbar) _GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP) _GUICtrlRebar_AddToolBarBand($hReBar, $hToolbar, "", 0) Global Const $iVSscroll = _WinAPI_GetSystemMetrics(2) Global Const $iHSscroll = _WinAPI_GetSystemMetrics(3) Global Const $iYCaption = _WinAPI_GetSystemMetrics(4) Global Const $iYFixedFrame = _WinAPI_GetSystemMetrics(8) Global Const $iXFixedFrame = _WinAPI_GetSystemMetrics(7) Global Const $iMetricsSumX = $iVSscroll + $iXFixedFrame * 2 Global Const $iMetricsSumY = $iHSscroll + $iYCaption + $iYFixedFrame _GUIScrollBars_Init($hGUI_Child) _GUIScrollBars_SetScrollInfoMin($hGUI_Child, $SB_HORZ, 0) _GUIScrollBars_SetScrollInfoMax($hGUI_Child, $SB_HORZ, $iImageW - $iW + 61 + $iMetricsSumX) _GUIScrollBars_SetScrollInfoMin($hGUI_Child, $SB_VERT, 0) _GUIScrollBars_SetScrollInfoMax($hGUI_Child, $SB_VERT, $iImageH - $iH + $iMetricsSumY + $height_delta - 1) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hGUI_Child) Global Const $STM_SETIMAGE = 0x0172 _WinAPI_DeleteObject(GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBMP_ScreenCapture)) _WinAPI_DeleteObject($hBMP_ScreenCapture) Global $IE_offset_x = 0, $IE_offset_y = 0 GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL_IE") GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL_IE") Do Until GUIGetMsg() = -3 GUIRegisterMsg($WM_HSCROLL, "") GUIRegisterMsg($WM_VSCROLL, "") Exit Func WM_HSCROLL_IE($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $lParam Local $Min, $Max, $Page, $TrackPos ; Get all the horizontal scroll bar information Local $tSCROLLINFO_X = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ) $Min = DllStructGetData($tSCROLLINFO_X, "nMin") $Max = DllStructGetData($tSCROLLINFO_X, "nMax") $Page = DllStructGetData($tSCROLLINFO_X, "nPage") ; Save the position for comparison later on $IE_offset_x = DllStructGetData($tSCROLLINFO_X, "nPos") $TrackPos = DllStructGetData($tSCROLLINFO_X, "nTrackPos") #forceref $Min, $Max Local $nScrollCode = BitAND($wParam, 0x0000FFFF) Switch $nScrollCode Case $SB_LINELEFT ; user clicked left arrow DllStructSetData($tSCROLLINFO_X, "nPos", $IE_offset_x - 1) Case $SB_LINERIGHT ; user clicked right arrow DllStructSetData($tSCROLLINFO_X, "nPos", $IE_offset_x + 1) Case $SB_PAGELEFT ; user clicked the scroll bar shaft left of the scroll box DllStructSetData($tSCROLLINFO_X, "nPos", $IE_offset_x - $Page) Case $SB_PAGERIGHT ; user clicked the scroll bar shaft right of the scroll box DllStructSetData($tSCROLLINFO_X, "nPos", $IE_offset_x + $Page) Case $SB_THUMBTRACK ; user dragged the scroll box DllStructSetData($tSCROLLINFO_X, "nPos", $TrackPos) EndSwitch ;~ // Set the position and then retrieve it. Due to adjustments ;~ // by Windows it may not be the same as the value set. DllStructSetData($tSCROLLINFO_X, "fMask", $SIF_POS) _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO_X) $IE_offset_x = DllStructGetData($tSCROLLINFO_X, "nPos") ControlMove("", "", $idPic, -$IE_offset_x, -$IE_offset_y) Return "GUI_RUNDEFMSG" EndFunc ;==>WM_HSCROLL_IE Func WM_VSCROLL_IE($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $lParam Local $Min, $Max, $Page, $TrackPos ;~ ; Get all the horizontal scroll bar information Local $tSCROLLINFO_Y = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT) $Min = DllStructGetData($tSCROLLINFO_Y, "nMin") $Max = DllStructGetData($tSCROLLINFO_Y, "nMax") $Page = DllStructGetData($tSCROLLINFO_Y, "nPage") ; Save the position for comparison later on $IE_offset_y = DllStructGetData($tSCROLLINFO_Y, "nPos") $TrackPos = DllStructGetData($tSCROLLINFO_Y, "nTrackPos") #forceref $Min, $Max Local $nScrollCode = BitAND($wParam, 0x0000FFFF) Switch $nScrollCode Case $SB_LINELEFT ; user clicked left arrow DllStructSetData($tSCROLLINFO_Y, "nPos", $IE_offset_y - 1) Case $SB_LINERIGHT ; user clicked right arrow DllStructSetData($tSCROLLINFO_Y, "nPos", $IE_offset_y + 1) Case $SB_PAGELEFT ; user clicked the scroll bar shaft left of the scroll box DllStructSetData($tSCROLLINFO_Y, "nPos", $IE_offset_y - $Page) Case $SB_PAGERIGHT ; user clicked the scroll bar shaft right of the scroll box DllStructSetData($tSCROLLINFO_Y, "nPos", $IE_offset_y + $Page) Case $SB_THUMBTRACK ; user dragged the scroll box DllStructSetData($tSCROLLINFO_Y, "nPos", $TrackPos) EndSwitch ;~ // Set the position and then retrieve it. Due to adjustments ;~ // by Windows it may not be the same as the value set. DllStructSetData($tSCROLLINFO_Y, "fMask", $SIF_POS) _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO_Y) $IE_offset_y = DllStructGetData($tSCROLLINFO_Y, "nPos") ControlMove("", "", $idPic, -$IE_offset_x, -$IE_offset_y) Return "GUI_RUNDEFMSG" EndFunc ;==>WM_VSCROLL_IE The important part is that I need scrollbars if the image is larger than the GUI to draw via GDI+ onto the image. Br, UEZ
×
×
  • Create New...