Jump to content
Sign in to follow this  
amokoura

A warning for GUICtrlSetBkColor() users

Recommended Posts

martin

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)
GUISetState(@SW_SHOW) 
GUICtrlSetBkColor($Button1, 0x00ff00)
$Button2 = GUICtrlCreateButton("Button1", 16, -140, 123, 25, 0);out of view

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE 
            Exit
        Case $Button1 
            MsgBox(0, "", "button1 triggered")
        Case $Button2
            MsgBox(0, "", "button2 triggered")
    EndSwitch
WEnd

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.

Share this post


Link to post
Share on other sites
amokoura

Only if you have the one button.

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

My GUI app was running nicely with 3.2.10.0 and colored buttons.

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

Share this post


Link to post
Share on other sites
amokoura

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

http://www.autoitscript.com/forum/index.php?showtopic=46170

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!

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.