Jump to content

Using "enter" to confirm adjustments to an input control.


Recommended Posts

I recently moved all the controls in one of my programs to child gui's to solve a problem I had with my statusbar. (Adressed here)

This worked nicely, but suddenly I can't confirm adjustments to my input controls using "enter" anymore.

I've made an example.

The top input displays the behaviour if the input is created in the main gui; it will trigger an event if it loses focus, or when enter is pressed.

The bottom input displays the behaviour if the input is created in the child gui; it will still trigger an event when it loses focus, but no longer when enter is pressed.

#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)

$MainGUI = GUICreate("",120,90)
GUISetOnEvent(-3,"_exit")
GUICtrlCreateInput("MainGUI",20,10,80)
GUICtrlSetOnEvent(-1,"_test")
GUICreate("child",100,40,10,40,$WS_Child,Default,$MainGUI)
GUISetBkColor(0x888888)
GUICtrlCreateInput("ChildGUI",10,10,80)
GUICtrlSetOnEvent(-1,"_test")
GUISetState()
GUISetState(@SW_SHOW,$MainGUI)

While 1
WEnd

Func _test()
    MsgBox(0,"test","test")
EndFunc

Func _exit()
    Exit
EndFunc

It might be an option to use "HotKeySet("{Enter}","_function"), but as there are a number of different functions that have to be called this way I was hoping for something more practical.

Ideally I'd just like to make a child gui behave the same as a parent gui.

Any help would be appreciated.

Tom

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...