Diana (Cda) Posted July 5, 2008 Share Posted July 5, 2008 (edited) Again, searches in help file and forum didn't reveal an answer I knew how to work with. I found lots about GUICtrlSetState ( controlID, state ), which seemed to be used as "GUICtrlSetState (1, $GUI_ONTOP)" but no matter where I put that in my GUI, didn't get an "ontop" condition. Ultimately, I found "WinSetOnTop" and that appears to work but it seems not to be a proper way to do this. I mean, I'm no expert, of course, but it seems that GUICtrlSetState would be more appropriate to use ... (?) Here is the pertinent part of the GUI. I put WinSetOnTop at the bottom of it. Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Open Folders ...", 301, 283, 193, 125) $Toolbar1 = GUICtrlCreateButton("1. PROGRAMS folder.", 35, 80, 235, 33, 0) ; left, top, width, height GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlSetOnEvent(-1, "Toolbar1Click") $Toolbar2 = GUICtrlCreateButton("2. DATA folder.", 35, 130, 235, 33, 0) ; left, top, width, height GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlSetOnEvent(-1, "Toolbar2Click") $Toolbar3 = GUICtrlCreateButton("3. VIDEO+AUDIO folder ...", 35, 180, 235, 33, 0) ; left, top, width, height GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlSetOnEvent(-1, "Toolbar3Click") $OK = GUICtrlCreateButton("OK, Done", 110, 243, 75, 25, 0) ; left, top, width, height GUICtrlSetOnEvent(-1, "OKClick") $Label1 = GUICtrlCreateLabel("Click on each button below to send the path" & @CRLF & "to the clipboard. Then retrieve the path" & @CRLF & "by pressing ^+v:", 16, 8, 261, 49) GUISetState(@SW_SHOW) WinSetOnTop("Open Folders ...", "", 1) How would one get "GUICtrlSetState (1, $GUI_ONTOP)" to work, pls? Thx. muttley Edited July 6, 2008 by Diana (Cda) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 5, 2008 Moderators Share Posted July 5, 2008 GUI Styles in help file: $WS_EX_TOPMOST Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
smashly Posted July 5, 2008 Share Posted July 5, 2008 (edited) Hi, few ways to set your gui to be ontop, the way I use is Extended Window Style, another way is a WinAPI call _WinAPI_SetWindowPos().. #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Open Folders ...", 301, 283, 193, 125, -1, $WS_EX_TOPMOST) GUISetOnEvent($GUI_EVENT_CLOSE, "Close", $Form1) $Toolbar1 = GUICtrlCreateButton("1. PROGRAMS folder.", 35, 80, 235, 33, 0) ; left, top, width, height GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") ;~ GUICtrlSetOnEvent(-1, "Toolbar1Click") $Toolbar2 = GUICtrlCreateButton("2. DATA folder.", 35, 130, 235, 33, 0) ; left, top, width, height GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") ;~ GUICtrlSetOnEvent(-1, "Toolbar2Click") $Toolbar3 = GUICtrlCreateButton("3. VIDEO+AUDIO folder ...", 35, 180, 235, 33, 0) ; left, top, width, height GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") ;~ GUICtrlSetOnEvent(-1, "Toolbar3Click") $OK = GUICtrlCreateButton("OK, Done", 110, 243, 75, 25, 0) ; left, top, width, height ;~ GUICtrlSetOnEvent(-1, "OKClick") $Label1 = GUICtrlCreateLabel("Click on each button below to send the path" & @CRLF & "to the clipboard. Then retrieve the path" & @CRLF & "by pressing ^+v:", 16, 8, 261, 49) GUISetState(@SW_SHOW) while 1 sleep(100) wend Func Close() Exit EndFunc Cheers edit: doh to slow again muttley Edited July 5, 2008 by smashly Link to comment Share on other sites More sharing options...
Diana (Cda) Posted July 6, 2008 Author Share Posted July 6, 2008 Hallelujah! Thank you so much!! I changed it just a tad (and I'm showing a different GUI as this is the one I'm working on today), but here is my version. I'm doing something very unusual, since the scripts don't compile without taking out the UDFs from their folder and putting them into same folder as the script that is being compiled, I've gone and extracted the pertinent syntax. That's why it's a bit weird. I'm more afraid of messing something up if I forget to copy and move the file, etc., etc. Seemed easier to put lots of references into which UDFs _should_ be in there yet not putting them in, etc., so that when I compile, no problems in not making copies of files, etc. expandcollapse popup; ; AutoIt 3x ; ;#include <GUIConstants.au3> ; not needed since I extracted $GUI_EVENT_CLOSE syntax below from the appropriate UDF ;#include <WindowsConstants.au3> ; not needed since I extracted $WS_EX_TOPMOST syntax below from the appropriate UDF #NoTrayIcon ; AutoIt's icon doesn't show in systray TraySetIcon(@ScriptDir & "\000- GUItool2USE2add to words db re GENERAL WORDS 01.ico") SoundPlay(@ScriptDir & "\(Music)- HTECH_01.MID") AutoItSetOption("WinTitleMatchMode", 2) ; this allows partial window titles to be valid! ShellExecute(@ScriptDir & "\listman.exe", "", "", "open", @SW_MAXIMIZE) WinWait("Acrostic 3.0") Sleep(1000) ;========================================================================= Global Const $GUI_EVENT_CLOSE = -3 ; by using this constant, could leave out reference to "#include <GUIConstants.au3>", which in turn referenced this variable, with this exact value, from "GUIConstantsEx.au3" Global Const $WS_EX_TOPMOST = 0x00000008 ; put this in so that no need to have UDF present when compiling Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Paths to the GENERAL 01 files to the clipboard ... ", 400, 300, 700, 175, -1, $WS_EX_TOPMOST) ; width, height, left, top GUISetOnEvent($GUI_EVENT_CLOSE, "Close", $Form1) ; put this in so that no need to have UDF present when compiling GUISetIcon(@ScriptDir & "\000- GUItool2USE2add to words db re GENERAL WORDS 01.ico") ; this changes icon in upper left-hand corner to your chosen one ;---------------------------------------------------------- $Toolbar1 = GUICtrlCreateButton("1. ''00b01- WORDLIST- GENERAL.txt'' ...", 50, 80, 300, 33, 0) ; left, top, width, height GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") ; 2nd # = font size GUICtrlSetOnEvent(-1, "Toolbar1Click") ;---------------------------------------------------------- $Toolbar2 = GUICtrlCreateButton("2. ''00b02- CluesDatabase- GENERAL.txt'' ...", 50, 130, 300, 33, 0) ; left, top, width, height GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") ; 2nd # = font size GUICtrlSetOnEvent(-1, "Toolbar2Click") ; --------------------------------------------------------- $OK = GUICtrlCreateButton("OK, Done", 160, 243, 75, 25, 0) ; left, top, width, height [OK button] GUICtrlSetOnEvent(-1, "OKClick") $Label1 = GUICtrlCreateLabel("Click on each button below to send the path to the clipboard." & @CRLF & _ "(Later retetrieve the path by pressing ^+v.)", 50, 25, 350, 50) ; left, top, width, height ; --------------------------------------------------------- ; CLOSE BUTTON on upper right-hand corner: GUISetOnEvent($GUI_EVENT_CLOSE, "Close") ; "X" closes app, line "Global Const $GUI_EVENT_CLOSE = -3" above. GUISetState(@SW_SHOW) ;========================================================================= While 1 Sleep(100) WEnd Func OKClick() Exit EndFunc Func Toolbar1Click() ClipPut(@ScriptDir & "\00b01- WORDLIST- GENERAL.txt") Beep(1000,15) Sleep(100) Beep(1000,15) EndFunc Func Toolbar2Click() ClipPut(@ScriptDir & "\00b02- CluesDatabase- GENERAL.txt") Beep(750,15) Sleep(25) Beep(75,15) EndFunc Func Close() Exit ; finished EndFunc ;==>close This GUI also has the capability recently learned to get those "X"'s in upper-right hand corner of GUI to close it. Thanks, guys! These scripts make life a whole heck of a lot easier! Much appreciated. muttley 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