Lucid Posted March 6, 2015 Share Posted March 6, 2015 I've searched the web and am turning up empty, so I'm hoping that someone here can help me out or point me in the right direction. This is the first time I've messed around with scrollbars and I can't seem to get things to work the way I want them to. I've got a large GUI that has several child GUIs that display various bits and pieces of info. I'm trying to set it so that some of these child GUIs all move at the same time when a scrollbar is used. I tried using the more native code as shown in the Help files, and then tried Melba's stuff: '?do=embed' frameborder='0' data-embedContent>> and still no luck. All I can get it to do is scroll one child GUI at a time. I can't seem to figure out how to do multiple child GUIs at once. In my example code (I just quick put it together to show what I'm trying to accomplish), how can I get $hGrandChild1 and $hGrandChild2 both to scroll up or down (at the same time) when I use a vertical scrollbar? Thanks! expandcollapse popup#include-once #include <ColorConstants.au3> #include <GDIPlus.au3> #include <GUIScrollbars_Ex.au3> AutoItSetOption("MustDeclareVars", 1) Local $bProceed = False Local $sTransparencyColor = 0xFFFFFF _GDIPlus_Startup() Local $hBackgroundImage = _GDIPlus_ImageLoadFromFile("background.png") Local $iWidth = _GDIPlus_ImageGetWidth($hBackgroundImage) Local $iHeight = _GDIPlus_ImageGetHeight($hBackgroundImage) Local $hParentGUI = GUICreate("Parent", $iWidth, $iHeight, -1, -1, $WS_POPUP, $WS_EX_LAYERED) _SetBitmap($hParentGUI, $hBackgroundImage, 255) Local $hChildGUI = GUICreate("Child", $iWidth, $iHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hParentGUI) GUISetBkColor($sTransparencyColor, $hChildGUI) _WinAPI_SetLayeredWindowAttributes($hChildGUI, $sTransparencyColor, 255) Local $hLabel1 = GUICtrlCreateLabel("Text on child GUI - should NOT scroll", 30, 40) GUICtrlSetColor($hLabel1, $COLOR_RED) GUICtrlSetBkColor($hLabel1, $COLOR_BLACK) Local $hGrandChild1 = GUICreate("GrandChild1", $iWidth, $iHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hChildGUI) GUISetBkColor($sTransparencyColor, $hGrandChild1) _WinAPI_SetLayeredWindowAttributes($hGrandChild1, $sTransparencyColor, 255) Local $hLabel2 = GUICtrlCreateLabel("Text on FIRST grandchild GUI - should scroll", 90, 120) GUICtrlSetColor($hLabel2, $COLOR_BLACK) GUICtrlSetBkColor($hLabel2, $COLOR_RED) Local $hGrandChild2 = GUICreate("GrandChild2", $iWidth, $iHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hChildGUI) GUISetBkColor($sTransparencyColor, $hGrandChild2) _WinAPI_SetLayeredWindowAttributes($hGrandChild2, $sTransparencyColor, 255) Local $hLabel2 = GUICtrlCreateLabel("Text on SECOND grandchild GUI - should scroll along with FIRST grandchild GUI", 110, 140) GUICtrlSetColor($hLabel2, $COLOR_BLACK) GUICtrlSetBkColor($hLabel2, $COLOR_RED) Local $hGreatGrandChildGUI = GUICreate("GreatGrandChild", $iWidth, $iHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hGrandChild1) GUISetBkColor($sTransparencyColor, $hGreatGrandChildGUI) _WinAPI_SetLayeredWindowAttributes($hGreatGrandChildGUI, $sTransparencyColor, 255) Local $hLabel3 = GUICtrlCreateLabel("Text on greatgrandchild GUI - doesn't matter if it scrolls or not", 120, 180) GUICtrlSetColor($hLabel3, $COLOR_BLACK) GUICtrlSetBkColor($hLabel3, $COLOR_YELLOW) GUISetState(@SW_SHOW, $hParentGUI) GUISetState(@SW_SHOW, $hChildGUI) GUISetState(@SW_SHOW, $hGrandChild1) GUISetState(@SW_SHOW, $hGrandChild2) GUISetState(@SW_SHOW, $hGreatGrandChildGUI) _GUIScrollbars_Generate($hGrandChild1, 0, 500) Do Sleep(200) Until $bProceed = True Exit Func _SetBitmap($hParentGUI, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend Const $AC_SRC_ALPHA = 1 $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hParentGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>_SetBitmap Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 6, 2015 Moderators Share Posted March 6, 2015 Lucid,Can you please explain why you need so many child GUIs. Your example is less that clear about exactly what you are trying to achieve. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Lucid Posted March 6, 2015 Author Share Posted March 6, 2015 In the production code, the main reason for so many GUIs is that I'm using .PNG files (with transparency) for custom buttons. The only reliable method I've found to create a custom graphical button is to create a separate GUI for the button (using the typical Default, Hover, Pressed look and feel). Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 6, 2015 Moderators Share Posted March 6, 2015 Lucid,Fine, but what has that got to do with scrolling? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Lucid Posted March 6, 2015 Author Share Posted March 6, 2015 In my example, mentally replace $hGrandChild1 and $hGrandChild2 with something like $hButton1 and $hButton2. They're 2 separate button GUIs (based on .PNG images - such as "SHOW MORE INFO" and "CONTACT SUPPORT") that need to scroll vertically, along with some other label text, that's all on the $hChildGUI GUI. The production code I'm currently hacking away at is like 6,000 lines of code - otherwise I'd post it here instead of my short example So I either need a way to scroll both button GUIs at the same time, or a different way of making a transparent PNG-based button (that can exist - without flickering - on top of a larger background PNG file). The only way I can do it so far is to use GUI-based buttons. Any suggestions? Thanks! 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