Jump to content

Disabled Editbox WITH color?


Go to solution Solved by BrewManNH,

Recommended Posts

Posted (edited)

Hey, I know that GUICtrlSetColor() changes the font color inside an editbox and setting the editboxes state to $GUI_DISABLE will disable it from being written used.

My question is... Is there anyway to disable the editbox AND change the font color inside the box? When ever I add the $GUI_DISABLE, it overwrites the color I set the it to (green in this case) and changes it to grey. Is there anyway to bypass this?

Also, is there a way to create padding inside the text box? I think that the text is too close to the border... Is there away to change the spacing from borders?
 

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region: Graphical User Interface

$wProgram = GUICreate("CraigsList Alert", 306, 210, 545, 295)
$wExecute = GUICtrlCreateButton("Execute", 8, 176, 65, 25)
$wCommand = GUICtrlCreateInput("", 8, 152, 289, 21)
$wConsole = GUICtrlCreateEdit("Welcome", 8, 8, 289, 145, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN))
$wStart   = GUICtrlCreateButton("Start", 80, 176, 65, 25)
$wFetch   = GUICtrlCreateButton("Fetch Data", 208, 176, 91, 25)


GUICtrlSetBkColor($wConsole, 0x000000)
GUICtrlSetBkColor($wCommand, 0x000000)
GUICtrlSetColor($wConsole, 0x80FF00)
GUICtrlSetColor($wCommand, 0x80FF00)
GUICtrlSetState($wConsole, $GUI_DISABLE)

GUISetState(@SW_SHOW)
#EndRegion

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Here is what I am talking about...

6e84PsY.jpg

Edited by MirnesC2
  • Solution
Posted

Try this instead.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#region: Graphical User Interface

$wProgram = GUICreate("CraigsList Alert", 306, 210, 545, 295)
$wExecute = GUICtrlCreateButton("Execute", 8, 176, 65, 25)
$wCommand = GUICtrlCreateInput("", 8, 152, 289, 21)
$wConsole = GUICtrlCreateEdit("Welcome", 8, 8, 289, 145, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $ES_READONLY)) ; <<<<<<<<<<<<<
$wStart = GUICtrlCreateButton("Start", 80, 176, 65, 25)
$wFetch = GUICtrlCreateButton("Fetch Data", 208, 176, 91, 25)


GUICtrlSetBkColor($wConsole, 0x000000)
GUICtrlSetBkColor($wCommand, 0x000000)
GUICtrlSetColor($wConsole, 0x80FF00)
GUICtrlSetColor($wCommand, 0x80FF00)
;~ GUICtrlSetState($wConsole, $GUI_DISABLE)

GUISetState(@SW_SHOW)
#endregion

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

 

Try this instead.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#region: Graphical User Interface

$wProgram = GUICreate("CraigsList Alert", 306, 210, 545, 295)
$wExecute = GUICtrlCreateButton("Execute", 8, 176, 65, 25)
$wCommand = GUICtrlCreateInput("", 8, 152, 289, 21)
$wConsole = GUICtrlCreateEdit("Welcome", 8, 8, 289, 145, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $ES_READONLY)) ; <<<<<<<<<<<<<
$wStart = GUICtrlCreateButton("Start", 80, 176, 65, 25)
$wFetch = GUICtrlCreateButton("Fetch Data", 208, 176, 91, 25)


GUICtrlSetBkColor($wConsole, 0x000000)
GUICtrlSetBkColor($wCommand, 0x000000)
GUICtrlSetColor($wConsole, 0x80FF00)
GUICtrlSetColor($wCommand, 0x80FF00)
;~ GUICtrlSetState($wConsole, $GUI_DISABLE)

GUISetState(@SW_SHOW)
#endregion

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Yup that worked, thanks! Now I just need to figure out how to indent WITHOUT adding extra spaces in my strings " (space)blah blah"

Posted

@TAB?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted (edited)

@TAB?

Yeeeaaah, that does work along with adding a space but I was hoping there would be another way to do it that didn't involving adding those macros and/or spaces. It would get messy later on. But if those are the only options then its no big deal I guess, it would have made the GUI look nicer but thats not too important.

Edited by MirnesC2

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