hummus Posted June 25, 2020 Posted June 25, 2020 (edited) Melba23 - I did not see that script that you mentioned that is in this post to turn GUIOnEventMode on and off. Actually - I came here looking for an answer to something related to your other project - the GuiExtender. You've written back to me regarding the missing spinners (GuiCtrlUpDown) in the GuiExtender and how to fix it with the init - which worked great. However, one of the spinners I'm using in my script is a spinner of float numbers instead of integers, and since the UpDown GUI control cannot do floats - I used this solution instead: https://www.autoitscript.com/forum/topic/33642-float-spinners-in-auto-it/?do=findComment&comment=243736 which uses the GUIOnEventMode for the updating of the input boxes with the "+"/"-" buttons. However, when I turn on the GuiOnEventMode - all other controls (GUIExtender and checkboxes) fail to work. So I tried to make a small checkbox that turns on and off the GUIOnEventMode - but obviously once I turn it on I cannot then turn it off. (I can post my script here but it's rather long) Any ideas? Thanks. On 5/2/2009 at 5:59 PM, Melba23 said: StrategicX, GUIOnEventMode mode switches on and off without problem - have a look at this post to see a script where it is switched on and off as the script runs. You will need to post some code if this does not help as there must be something else wrong. M23 Edited June 25, 2020 by Melba23 Fixed quote formatting
Moderators Melba23 Posted June 25, 2020 Moderators Posted June 25, 2020 hummus, I have split your post form the 11 year-old thread in which you placed it - please do not necro-post like that in future, particularly as your question has little to do with its original subject. Many old links were broken during one of the old forum updates - hence the lack of a link above. I will reply to your questions when I have researched them a bit. 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
Moderators Melba23 Posted June 25, 2020 Moderators Posted June 25, 2020 hummus, Before offering some solutions for your problems, we need to talk about switching between GUI modes in AutoIt. You can only operate a script in one mode at a time - you cannot have some controls in MessageLoop mode and others in OnEvent (the only exception to this is that the traymenu can operate simultaneously in a different mode). However, you can switch between modes during script execution as you can see here: expandcollapse popup#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Global $iOldMode = 0, $hChild $hGUI = GUICreate("MsgLoop", 300, 300, 100, 100) $cChild = GUICtrlCreateButton("OnEvent GUI Create", 10, 10, 120, 30) $cTestMsgLoop = GUICtrlCreateButton("MsgLoop Test", 10, 100, 120, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cChild _Child() Case $cTestMsgLoop MsgBox($MB_SYSTEMMODAL, "Pressed", "MsgLoop Mode") EndSwitch WEnd Func _Child() ; Set OnEvent and save old mode $iOldMode = Opt("GUIOnEventMode", 1) ;GUISetState(@SW_DISABLE, $hGUI) $hChild = GUICreate("OnEvent", 200, 200, 500, 500) GUISetOnEvent($GUI_EVENT_CLOSE, "_EndChild", $hChild) $cTestOnEvent = GUICtrlCreateButton("OnEvent Test", 10, 10, 180, 30) GUICtrlSetOnEvent($cTestOnEvent, "_Test") GUISetState() EndFunc Func _Test() MsgBox($MB_SYSTEMMODAL, "Pressed", "OnEvent Mode") EndFunc Func _EndChild() GUIDelete($hChild) ; Reset old mode Opt("GUIOnEventMode", $iOldMode) EndFunc Once the child GUI is created, the whole script switches into OnEvent mode and only those controls in the child GUI are active - the GUIGetMsg loop is completely redundant and no controls in the first GUI will action. Once the child is closed and the script switches back to MessageLoop mode, the main GUI functions once again. Normally there is no requirement to do this in a script - but it is useful when writing UDFs and you do not know what mode the calling script will be using. Look at my ExtMsgBox or Toast UDFs to see how I force the script into MsgLoop mode and then reset it if needed. Please ask if you have any further questions. As to the floating number UpDown - perhaps something like this will work for you: Again, please ask if you need any refinement to the code. I hope all the above is clear and answers your questions satisfactorily. 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
Moderators Melba23 Posted June 25, 2020 Moderators Posted June 25, 2020 hummus, Another way to cheat with the UpDown: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Global $iInitialValue = 10 Global $iIncrement = .1 $hGUI = GUICreate("Test", 500, 500) $cInput = GUICtrlCreateInput($iInitialValue, 10, 10, 50, 20) $cDummyInput = GUICtrlCreateInput("", 75, 10, 1, 20) GUICtrlCreateUpdown($cDummyInput) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cDummyInput GuiCtrlSetData($cInput, $iInitialValue + GuiCtrlRead($cDummyInput) * $iIncrement) EndSwitch WEnd 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
hummus Posted June 29, 2020 Author Posted June 29, 2020 Melba23, Sorry about the mess with the threads. Was not aware about all of that. Your explanation was great, and the last solution was just in place and helped a lot! Thanks. Now all works well. Well - I do have a little visual remaining issue with GUIExtender - but I'll go to that thread and ask it there. Thanks!
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