Radsam Posted February 17, 2005 Share Posted February 17, 2005 I am having dificulties in getting the "Top Most" attribute to work properly. Could someone test my code and point out what the issue is. AutoIT ver: v3.1.0 Thanks expandcollapse popup#include <GUIConstants.au3> #Region A3 Pad Gui & Parameters $MainTitle = "Test Notepad" $MainWidth = 180; -1 = 400 $MainHeight = 115; -1 = 400 $MainLeftPos = -1;-1 is Center $MainTopPos = -1;-1 is Center $MainStyle = $WS_MINIMIZEBOX + $WS_MAXIMIZEBOX + $WS_VSCROLL + $WS_SIZEBOX;-1 is default which is: $WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU $MainExStyle = -1; -1 is default ;$MainParent = $cIASNotepad = GUICreate($MainTitle, $MainWidth, $MainHeight, $MainLeftPos, $MainTopPos, $MainStyle, $MainExStyle) #EndRegion #Region A3 Pad Edit & Parameters $EditText = "" $EditLeftPos = -1 $EditTopPos = 0 $EditWidth = 383 $EditHeight = 352 $EditStyle = $ES_AUTOVSCROLL + $ES_WANTRETURN;default -1: $ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL $EditExStyle = -1 $myedit = GUICtrlCreateEdit($EditText, $EditLeftPos, $EditTopPos, $EditWidth, $EditHeight, $EditStyle, $EditExStyle) #EndRegion #region A3 Pad File Menu & Parameters $MenuTitleFile = "&File"; Menu text (The "&" denotes "Alt-" hotkey letter) $MenuIDFile = -1; Used for submenu reference $MenuEntryFile = 1; Order GUICtrlCreateMenu ($MenuTitleFile, $MenuIDFile, $MenuEntryFile) #endregion #region A3 Pad Edit Menu & Parameters $MenuTitleEdit = "&Edit"; Menu text (The "&" denotes "Alt-" hotkey letter) $MenuIDEdit = -1; Used for submenu reference $MenuEntryEdit = 2; Order GUICtrlCreateMenu ($MenuTitleEdit, $MenuIDEdit, $MenuEntryEdit) #endregion #region A3 Pad View Menu & Parameters $MenuTitleEdit = "&View"; Menu text (The "&" denotes "Alt-" hotkey letter) $MenuIDEdit = -1; Used for submenu reference $MenuEntryEdit = 3; Order $cViewMenu = GUICtrlCreateMenu ($MenuTitleEdit, $MenuIDEdit, $MenuEntryEdit) #region View Menu Items $cViewMenuOnTop = GUICtrlCreateMenuitem ("On Top", $cViewMenu) GUICtrlSetState(-1,$GUI_UNCHECKED) #endregion #endregion #region A3 Pad Help Menu & Parameters $MenuTitleHelp = "&Help"; Menu text (The "&" denotes "Alt-" hotkey letter) $MenuIDHelp = -1; Used for submenu reference $MenuEntryHelp = 4; Order GUICtrlCreateMenu ($MenuTitleHelp, $MenuIDHelp, $MenuEntryHelp) #endregion GUISetState() GUICtrlSetData($myedit, "") ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit 0 If $msg = $cViewMenuOnTop Then If BitAnd(GUICtrlRead($cViewMenuOnTop),$GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($cViewMenuOnTop,$GUI_UNCHECKED) $iDebug = GUICtrlSetStyle ($cIASNotepad, $MainStyle, $MainExStyle) MsgBox(0,"Debug", $iDebug) Else GUICtrlSetState($cViewMenuOnTop,$GUI_CHECKED) $iDebug = GUICtrlSetStyle ($cIASNotepad, $MainStyle, $WS_EX_TOPMOST) MsgBox(0,"Debug", $iDebug) EndIf EndIf WEnd Link to comment Share on other sites More sharing options...
Developers Jos Posted February 17, 2005 Developers Share Posted February 17, 2005 I am having dificulties in getting the "Top Most" attribute to work properly. Could someone test my code and point out what the issue is.AutoIT ver: v3.1.0Thanks<{POST_SNAPBACK}>You are setting a Control exStyle but you want to set the Window exStyle.What about this way?:While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit 0 If $msg = $cViewMenuOnTop Then If BitAnd(GUICtrlRead($cViewMenuOnTop),$GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($cViewMenuOnTop,$GUI_UNCHECKED) $iDebug = WinSetOnTop($MainTitle,"",0) ;MsgBox(0,"Debug1", $iDebug) Else GUICtrlSetState($cViewMenuOnTop,$GUI_CHECKED) $iDebug = WinSetOnTop($MainTitle,"",1) ;MsgBox(0,"Debug2", $iDebug) EndIf EndIf WEnd SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Radsam Posted February 17, 2005 Author Share Posted February 17, 2005 I didn't realize this function existed: WinSetOnTop Thanks for the quick help... 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