aGorilla Posted May 7, 2008 Share Posted May 7, 2008 Like the title says, I want to have a checkbox that determines whether the window should 'stay on top', or not. I've tried variations on this, but none of them are working. All suggestions welcome. expandcollapse popup#include <GUIConstants.au3> Opt('GUIOnEventMode', 1) Opt('GUICoordMode', 2) Global $Win_Data, $Stay ShowData() While 1 sleep(250) Wend Func ShowData() Local $lh, $lw, $vh, $vw, $ClickDone $Win_Data = GUICreate( 'The Top Window', 390, 250, -1, -1, _ $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS _ ) $Stay = GUICtrlCreateCheckbox('Stay On Top', 10, 10, 100, 20) GUICtrlSetOnEvent($Stay, 'DataStay') GUISetOnEvent($GUI_EVENT_CLOSE, 'DataDone') GUISetState(@SW_SHOW, $Win_Data);Show GUI EndFunc Func DataDone() GUIDelete($Win_Data);Kill GUI EndFunc Func DataStay() If GUICtrlRead($Stay) = 1 Then Local $stay = GUISetStyle($WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS, $WS_EX_TOPMOST, $Win_Data) Else GUISetStyle($WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS, 0, $Win_Data) EndIf EndFunc Search AutoItScript.com via Google Link to comment Share on other sites More sharing options...
Monamo Posted May 7, 2008 Share Posted May 7, 2008 Like the title says, I want to have a checkbox that determines whether the window should 'stay on top', or not. I've tried variations on this, but none of them are working. All suggestions welcome. expandcollapse popup#include <GUIConstants.au3> Opt('GUIOnEventMode', 1) Opt('GUICoordMode', 2) Global $Win_Data, $Stay ShowData() While 1 sleep(250) Wend Func ShowData() Local $lh, $lw, $vh, $vw, $ClickDone $Win_Data = GUICreate( 'The Top Window', 390, 250, -1, -1, _ $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS _ ) $Stay = GUICtrlCreateCheckbox('Stay On Top', 10, 10, 100, 20) GUICtrlSetOnEvent($Stay, 'DataStay') GUISetOnEvent($GUI_EVENT_CLOSE, 'DataDone') GUISetState(@SW_SHOW, $Win_Data);Show GUI EndFunc Func DataDone() GUIDelete($Win_Data);Kill GUI EndFunc Func DataStay() If GUICtrlRead($Stay) = 1 Then Local $stay = GUISetStyle($WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS, $WS_EX_TOPMOST, $Win_Data) Else GUISetStyle($WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS, 0, $Win_Data) EndIf EndFuncModify your DataStay() function to use WinSetOnTop() instead of GUISetStyle(): Func DataStay() If GUICtrlRead($Stay) = $GUI_CHECKED Then WinSetOnTop($Win_Data,"", 1) Else WinSetOnTop($Win_Data,"", 0) EndIf EndFunc - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup] Link to comment Share on other sites More sharing options...
aGorilla Posted May 7, 2008 Author Share Posted May 7, 2008 Wow, not only does it work, but it looks so much nicer! Thanks much kind sir! Search AutoItScript.com via Google 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