Jump to content

Recommended Posts

Posted

I've been playing around with a program called MCL. Its a small text entry field that sits on your desktop and allows you to do things like launch programs, run dos commands and explorer folders.

I'm making my own, one that is more customisable and suited to the way I work. I have encountered a couple of problems though:

I have created an input gui control. When my script receives a gui event it is executed. However, I'd like this gui event to be executed whenever the enter key is pressed. At the moment I have to click out of the window for it to make any difference. I tried creating a small button and setting it as the default button for that page, hoping that by pressing enter whilst focus is on the input control, this default button would be activated thus causing the gui event from the input control to be activated but this didn't seem to work. How can I get a function to execute simply when the Enter key is pressed?

Also, is there any way in autit to hide the window title bar so that only the input control (and perhaps a small border of the GUI) is visible? I've looked through all the styles and extended styles but none seem to do what I want.

Any help greatly appreciated!

Posted (edited)

I have created an input gui control. When my script receives a gui event it is executed. However, I'd like this gui event to be executed whenever the enter key is pressed. At the moment I have to click out of the window for it to make any difference. I tried creating a small button and setting it as the default button for that page, hoping that by pressing enter whilst focus is on the input control, this default button would be activated thus causing the gui event from the input control to be activated but this didn't seem to work. How can I get a function to execute simply when the Enter key is pressed?

Edit: forgot previous stupid code...

#include <GUIConstants.au3>

GUICreate("GUI", 220, 100)
$input = GUICtrlCreateInput("", 0, 0)
$button = GUICtrlCreateButton("Run", 30, 50, 80, 24)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
GUISetState ()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $button
            MsgBox (0, "Text entered", GUICtrlRead($input))
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
Wend

Also, is there any way in autit to hide the window title bar so that only the input control (and perhaps a small border of the GUI) is visible? I've looked through all the styles and extended styles but none seem to do what I want.

Easily. Just add $WS_POPUP or $WS_POPUPWINDOW style to GUI (try and you see difference).

BTW you can search forum for ezzetabi's "Run!" program for some references.

Edited by Lazycat
Posted

thankyou very much!

That run! program is impressive - but goes beyond the scope of what i wanted to do. I'll probably pinch ideas off him!

Still, I want the challenge of doing it for myself.

Posted

BTW you can search forum for ezzetabi's "Run!" program for some references.

Lazycat, you make me curious, and I seem to be not clevel enough to find that "Run!" program of ezzetabi. Can you make me a link to this program? Using search on the Forums did not help me, but I presume it's my mistake.

Thanks!

rkn

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...