Jump to content

Recommended Posts

Posted (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 by Melba23
Fixed quote formatting

Share this post


Link to post
Share on other sites

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


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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:

#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


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...