Jump to content
Sign in to follow this  
Kaso

Active Input Ctrl Color

Recommended Posts

Kaso

Is it possible to change the color of the inputctrl when the cursor is in the ctrl. Making it easier to see which box you are typing in?

Share this post


Link to post
Share on other sites
GaryFrost

#include <GUIConstants.au3>

If Not IsDeclared('White') Then Dim $White = 0xffffff
If Not IsDeclared('Midnight_Blue') Then Dim $Midnight_Blue = 0x191970
If Not IsDeclared('Black') Then Dim $Black = 0x000000
If Not IsDeclared('White') Then Dim $White = 0xFFFFFF

GUICreate(" My GUI input acceptfile", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
$file = GUICtrlCreateInput("", 10, 5, 300, 20)
GUICtrlSetState(-1, $GUI_ACCEPTFILES)
$nofile = GUICtrlCreateInput("", 10, 35, 300, 20); will not accept drag&drop files
$btn = GUICtrlCreateButton("Ok", 40, 75, 60, 20)

GUISetState()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
   $msg = GUIGetMsg()
   Select
      Case $msg = $btn
         ExitLoop
   EndSelect
   If ControlGetFocus(" My GUI input acceptfile") = "Edit1" Then
      GUICtrlSetColor($file, $White)
      GUICtrlSetBkColor($file, $Midnight_Blue)
      GUICtrlSetColor($nofile, $Black)
      GUICtrlSetBkColor($nofile, $White)
   ElseIf ControlGetFocus(" My GUI input acceptfile") = "Edit2" Then
      GUICtrlSetColor($file, $Black)
      GUICtrlSetBkColor($file, $White)
      GUICtrlSetColor($nofile, $White)
      GUICtrlSetBkColor($nofile, $Midnight_Blue)
   EndIf
WEnd

MsgBox(4096, "drag drop file", GUICtrlRead($file))

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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.