Jump to content

Not working default button


sasdad
 Share

Recommended Posts

Hi,

I'm having problem with setting default button.

I'm writing you because the problem is similar to ones that you have answered.

Everything works fine, but when I press key ENTER it doesn't do the function BUTTON.

When I comment line $GUIActiveX = GUICtrlCreateObj($IE, 0, 0, 680, 510) then the button when I press ENTER works fine. But I need this line :D

What is interesting is that when I comment lines $Input = GuiCtrlCreateInput("", 60, 40, 85, -1, $ES_PASSWORD) and "GUICtrlSetState($Input,$GUI_FOCUS) then the button on pressing ENTER key works only one time and then the ENTER is like death.

Do you know how to fix it or where is the problem.

IE.au3 file can be downloaded from pages IE.au3 Library Homepage or direct link for this file is IE.au3 Library

Thank you very much for you help

I'm using the latest beta version build 126

#include <GuiConstants.au3>
#include <IE.au3>

Opt("GUIOnEventMode", 1)
$IE = _IECreateEmbedded ()

$GUI = GUICreate("Title", 680, 510, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_DISABLED)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE")

$GUIActiveX = GUICtrlCreateObj($IE, 0, 0, 680, 510); <----- This line

$GUI1 = GUICreate("Title", 170, 100, -1, -1, $WS_OVERLAPPED + $WS_CAPTION + $WS_VISIBLE + $WS_SYSMENU)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE")

$Label = GuiCtrlCreateLabel("Pass:", 25, 43)
$Input = GuiCtrlCreateInput("", 60, 40, 85, -1, $ES_PASSWORD)
GUICtrlSetState($Input,$GUI_FOCUS)

$Button = GuiCtrlCreateButton("OK", 45, 70, 80)
GUICtrlSetOnEvent($Button, "BUTTON")
GUICtrlSetState($Button,$GUI_DEFBUTTON)


While 1
    Sleep(1000)
WEnd

Func BUTTON()
    MsgBox(0,"Working","Working")
EndFunc

Func CLOSE()
    Exit
EndFunc
Link to comment
Share on other sites

Hi,

haven't tested why you've got that prob, but maybe you could live with this:

#include <GuiConstants.au3>
#include <IE.au3>

HotKeySet("{Enter}" , "_iii")

Opt("GUIOnEventMode", 1)
$IE = _IECreateEmbedded ()

$GUI = GUICreate("Title", 680, 510, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_DISABLED)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE")

$GUIActiveX = GUICtrlCreateObj($IE, 0, 0, 680, 510); <----- This line

$GUI1 = GUICreate("Title", 170, 100, -1, -1, $WS_OVERLAPPED + $WS_CAPTION + $WS_VISIBLE + $WS_SYSMENU)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE")

$Label = GuiCtrlCreateLabel("Pass:", 25, 43)
$Input = GuiCtrlCreateInput("", 60, 40, 85, -1, $ES_PASSWORD)
GUICtrlSetState($Input,$GUI_FOCUS)

$Button = GuiCtrlCreateButton("OK", 45, 70, 80)
GUICtrlSetOnEvent($Button, "BUTTON")
GUICtrlSetState($Button,$GUI_DEFBUTTON)


While 1
    Sleep(1000)
WEnd

Func _iii()
    ControlClick("","", $Button)
EndFunc


Func BUTTON()
    MsgBox(0,"Working","Working")
EndFunc

Func CLOSE()
    Exit
EndFunc

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Maybe I can live with this, but it's not clean and then I can't use ENTER, but I have more complicated form, where need to choose item from Combo. I know I can choose it without ENTER but you know ....

Edited by sasdad
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...