Jump to content

A warning for GUICtrlSetBkColor() users

Recommended Posts

By using GUICtrlSetBkColor() on a button causes it to catch enter key.

More info: http://svn.autoitscript.com/trac/ticket/376

Only if you have the one button. If you do this the effect disappears.

#include <GUIConstants.au3>
GUICreate("Form1", 166, 189, 234, 191)
GUICtrlCreateInput("Input1", 16, 8, 121, 21)
$Button1 = GUICtrlCreateButton("Button1", 16, 40, 123, 25, 0)
GUICtrlSetBkColor($Button1, 0x00ff00)
$Button2 = GUICtrlCreateButton("Button1", 16, -140, 123, 25, 0);out of view

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE 
        Case $Button1 
            MsgBox(0, "", "button1 triggered")
        Case $Button2
            MsgBox(0, "", "button2 triggered")
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Only if you have the one button.

With the latest version ( that trick doesn't help.

My GUI app was running nicely with and colored buttons.

After I updated to the latest the enter catching bug appeared.

Link to comment
Share on other sites

Looks like this behaviour might be a by-product of trying to fix an old (unfixable?) bug...


The example I posted there now seems to work the way it should :P , but obviously now has the problem you pointed out :)

Funny. The bugfix was too effective that time :P

Coloured buttons swallow every keyboard input in future versions!

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

  • Recently Browsing   0 members

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