Jump to content

Active Input Ctrl Color


Recommended Posts

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

 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...