qwert Posted May 6, 2008 Share Posted May 6, 2008 I have a GUI with a drag area defined per the following:The extended style $GUI_WS_EX_PARENTDRAG can be used to allow the dragging of the parent window for windows that don't have a titlebarNow I find I need a button in that same area. Can a button be created on top of another button?So far, the one(s) I've created don't work. After reading some posts, I thought I might just be able to add the style $WS_CLIPSIBLINGS to the create for the drag area -- but that didn't work either.Thanks for any help. Link to comment Share on other sites More sharing options...
martin Posted May 6, 2008 Share Posted May 6, 2008 I have a GUI with a drag area defined per the following:Now I find I need a button in that same area. Can a button be created on top of another button?So far, the one(s) I've created don't work. After reading some posts, I thought I might just be able to add the style $WS_CLIPSIBLINGS to the create for the drag area -- but that didn't work either.Thanks for any help.I'm not clear whay you want a button on top of another button. Do yu mean you have used a button to drag the window? I didn't know you could do that butI wouldn't have thought it was worth trying. You can use a label with the extended style $GUI_WS_EX_PARENTDRAG, and you can set its style to $WS_CLIPSIBLINGS to ensure the butons show. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
qwert Posted May 6, 2008 Author Share Posted May 6, 2008 You can use a label with the extended style $GUI_WS_EX_PARENTDRAG, and you can set its style to $WS_CLIPSIBLINGS to ensure the butons show.That's exactly what I tried, but the drag area was still active on top of the defined button. BTW, the new button is defined after the drag area "button" is defined -- if that matters.Any suggestions? Link to comment Share on other sites More sharing options...
Valuater Posted May 6, 2008 Share Posted May 6, 2008 Any suggestions?show your code8) Link to comment Share on other sites More sharing options...
Siao Posted May 6, 2008 Share Posted May 6, 2008 BTW, the new button is defined after the drag area "button" is defined -- if that matters.Yes, it does.Another approach would be to enable dragging on entire window. There are several methods, all evolve around generating non-client click event when user presses mouse button. Search forum for HTCAPTION "be smart, drink your wine" Link to comment Share on other sites More sharing options...
martin Posted May 6, 2008 Share Posted May 6, 2008 Yes, it does. Another approach would be to enable dragging on entire window. There are several methods, all evolve around generating non-client click event when user presses mouse button. Search forum for HTCAPTION Or you could do something like this #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("exit button won't work until you press 'change'",-1,-1,-1,-1);,$WS_POPUP) $Labelb = MakeLabel() $b = GUICtrlCreateButton("exit",10,10,80,22) $b2 = GUICtrlCreateButton("change",10,200,80,22) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $b Then ExitLoop If $msg = $b2 Then GUICtrlDelete($Labelb) MakeLabel() EndIf WEnd Func MakeLabel() Local $lab = GUICtrlCreateLabel("", 0, 0,200, 100, $WS_CLIPSIBLINGS, $GUI_WS_EX_PARENTDRAG) GUICtrlSetBkColor(-1,0xff3322) Return $lab EndFunc Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
qwert Posted May 6, 2008 Author Share Posted May 6, 2008 Or you could do something like thisThanks, Martin. I simplified what you suggested to the minimum and got this result: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("Button works from the start",-1,-1,-1,-1);,$WS_POPUP) $button = GUICtrlCreateButton("exit",45,35,80,22) GUICtrlCreateLabel("", 0, 0, 200, 100, $WS_CLIPSIBLINGS, $GUI_WS_EX_PARENTDRAG) GUICtrlSetBkColor(-1,0xff3322) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $button Then ExitLoop WEnd It works (because of the creation order, I suppose) in this controlled example -- but will it hold up for a more complicated GUI with 20 buttons and fields? I'll test that tomorrow -- unless someone can offer the answer. 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