TeddyTech Posted February 24, 2011 Share Posted February 24, 2011 I'm simply trying to toggle a form title bar and frame off and on. If I click on the label on the form I can turn everything off, but I cannot seem to figure out how to toggle it back on. (This is for a temperature monitoring window that I want to show just the temperature value in a large font with no frame, but have the ability to turn on the title bar to make it easy to position the window.) Here's a simple example of what my code so far: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Toggle=True Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Form1", 120, 150, 192, 114,$WS_SYSMENU) $Label1 = GUICtrlCreateLabel("Click Here to toggle header", 0, 0) GUICtrlSetOnEvent(-1, "LabelPressed") GUISetState(@SW_SHOW) While 1 Sleep(500) WEnd Exit Func LabelPressed() If $Toggle Then GUISetStyle($WS_POPUPWINDOW) GUICtrlSetData($Form1, 'Undo Style') $Toggle = NOT $Toggle Else GUISetStyle($WS_SYSMENU) GUICtrlSetData($Form1, 'Set Style') $Toggle = NOT $Toggle EndIf EndFunc Thanks for any help. Teddy Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 24, 2011 Moderators Share Posted February 24, 2011 TeddyTech,Welcome to the AutoIt forum. Whiel I am looking at your script, you might like to look at the Moving and Resizing PopUp GUIs tutorial in the Wiki. It might make the whole problem moot if you can easily position the pop-up window. 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...
Moderators Melba23 Posted February 24, 2011 Moderators Share Posted February 24, 2011 TeddyTech, Solution was simple. If you want the $WS_SYSMENU style, it says int eh Help file that you must also specify the $WS_CAPTION style. And when you do this you get what you want: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Toggle = True Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Form1", 120, 150, 192, 114, $WS_SYSMENU) $Label1 = GUICtrlCreateLabel("Click Here to toggle header", 0, 0) GUICtrlSetOnEvent(-1, "LabelPressed") GUISetState(@SW_SHOW) While 1 Sleep(500) WEnd Exit Func LabelPressed() If $Toggle Then GUISetStyle($WS_POPUPWINDOW) GUICtrlSetData($Form1, 'Undo Style') $Toggle = Not $Toggle Else GUISetStyle(BitOr($WS_SYSMENU, $WS_CAPTION)) GUICtrlSetData($Form1, 'Set Style') $Toggle = Not $Toggle EndIf EndFunc ;==>LabelPressed But I recommend the tutorial anyway! 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...
TeddyTech Posted February 24, 2011 Author Share Posted February 24, 2011 Melba23, Duh! I've been using AutoIT a lot for several years, but never much with the GUI. I looked all over the help files, but missed that little tidbit. And I will definitely look at the wiki. I would really like to be able to make the window movable without having to put a title bar on it and it sounds like that page may tell me how. Thanks again for the accurate ... and quick ... assistance. Teddy Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 24, 2011 Moderators Share Posted February 24, 2011 TeddyTech, My pleasure. 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...
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