Jump to content

Recommended Posts

Posted

My friends i would like to know how to change the text color that a user types in a TAEdit control..

I am trying to build a very simple text editor where a user has the option to change the text color or the bg color.

Thank you in advance for any help.

I search the forum about color change but nothing to use..

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("I want to be a text editor", 663, 387, 200, 137)
$MenuItem1 = GUICtrlCreateMenu("Options")
$MenuItem2 = GUICtrlCreateMenuItem("Change text color", $MenuItem1)
$MenuItem3 = GUICtrlCreateMenuItem("Change Bg color", $MenuItem1)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 625, 329)
GUICtrlSetData(-1, "")
GUICtrlSetColor(-1, 0xff0000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
EndSwitch
WEnd

[font="verdana, geneva, sans-serif"] [/font]

  • Moderators
Posted

armoros,

I wonder why we have a Help file sometimes - did you try searching that. Because there are a couple of pretty obvious candidates to do what you want: ;)

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#region ### START Koda GUI section ### Form=
$Form2 = GUICreate("I want to be a text editor", 663, 387, 200, 137)
$MenuItem1 = GUICtrlCreateMenu("Options")
$MenuItem2 = GUICtrlCreateMenuItem("Change text color", $MenuItem1)
$MenuItem3 = GUICtrlCreateMenuItem("Change Bg color", $MenuItem1)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 625, 329)
GUICtrlSetData(-1, "")
GUICtrlSetColor(-1, 0xff0000)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $MenuItem2
            $iCol = _ChooseColor()
            GUICtrlSetColor($Edit1, $iCol) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        Case $MenuItem3
            $iCol = _ChooseColor()
            GUICtrlSetBkColor($Edit1, $iCol) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    EndSwitch
WEnd

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted
  Quote

I wonder why we have a Help file sometimes

...and wiki too.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

  • Moderators
Posted

armoros,

No need to be - just look a bit harder next time. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

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
×
×
  • Create New...