supersonic Posted June 9, 2011 Share Posted June 9, 2011 (edited) Hi everyone, I'm trying to place Button controls over a TreeView control. With this Buttons I would like to collapse/expand the TreeView. Here's the sample code: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUITreeView.au3> #include <WindowsConstants.au3> Local $hGUI = GUICreate("", 800, 600, -1, -1, BitOR($WS_CAPTION, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_POPUP, $WS_SIZEBOX, $WS_SYSMENU)) Local $hGUI_TV0 = GUICtrlCreateTreeView(25, 102, 350, 456, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) Local $hGUI_B1 = GUICtrlCreateButton("", 330, 100, 18, 18, $BS_ICON) Local $hGUI_B2 = GUICtrlCreateButton("", 350, 100, 18, 18, $BS_ICON) GUICtrlCreateTreeViewItem("TEST", $hGUI_TV0) GUICtrlSetState($hGUI_B1, $GUI_ONTOP) GUICtrlSetState($hGUI_B2, $GUI_ONTOP) GUISetState(@SW_SHOW, $hGUI) While 1 Local $msg = GUIGetMsg(1) Switch $msg[1] Case $hGUI Switch $msg[0] Case $GUI_EVENT_CLOSE ExitLoop EndSwitch EndSwitch Sleep(10) WEnd GUIDelete($hGUI) How to avoid the Button controls hiding behind the TreeView control? Greets, -supersonic. Edited June 9, 2011 by supersonic Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 9, 2011 Moderators Share Posted June 9, 2011 supersonic,You use the $WS_EX_TOPMOST extened style, but (and it is a big but).........You will not be able to place the button on top of the TreeView as AutoIt gets confused when you overlap 2 controls. As it cannot decide which you want to action, it refuses to action either in the overlap area. Look at this slightly modified version of your script where I have moved the left button: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUITreeView.au3> #include <WindowsConstants.au3> Local $hGUI = GUICreate("", 800, 600, -1, -1, BitOR($WS_CAPTION, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_POPUP, $WS_SIZEBOX, $WS_SYSMENU)) Local $hGUI_TV0 = GUICtrlCreateTreeView(25, 102, 350, 456, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) Local $hGUI_B1 = GUICtrlCreateButton("", 330, 95, 18, 18, $BS_ICON, $WS_EX_TOPMOST) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Local $hGUI_B2 = GUICtrlCreateButton("", 350, 100, 18, 18, $BS_ICON, $WS_EX_TOPMOST) GUICtrlCreateTreeViewItem("TEST", $hGUI_TV0) GUISetState(@SW_SHOW, $hGUI) While 1 Local $msg = GUIGetMsg(1) Switch $msg[1] Case $hGUI Switch $msg[0] Case $GUI_EVENT_CLOSE ExitLoop Case $hGUI_B1 MsgBox(0, "Pressed", "I am working") EndSwitch EndSwitch ; Sleep(10) - not needed when you use GUIGetMsg <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< WEnd GUIDelete($hGUI)Try and action the left button by pressing on the lower part within the TreeView - you will not get the MsgBox. It will only appear if you press on the part of the button outside the TreeView.All clear? 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...
supersonic Posted June 9, 2011 Author Share Posted June 9, 2011 Melba, thank you for your reply. I tried $WS_EX_TOPMOST, etc. already before... With the very same result... But this is not a real problem; I just thought this would look nice... Greets, -supersonic. 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