Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Change Text Color in GUI



  • Please log in to reply
4 replies to this topic
mikek
  • Members
  • 161 posts
  • Last active: Nov 09 2015 05:02 PM
  • Joined: 21 Nov 2008

Hi all, I would like to change the color of a specific text item in my gui but am unsure how to do this.

 

Here's how I make the text:

Gui, Add, Text, y%yPos% x%xPos% vSelectASegment, Select a Segment

 

I can change the string using this command:

guiControl, , SelectASegment, Select a Segment - Updated!

 

Does anyone know the command to change the color of that text item?

 

Thank you for your help.

 

- Mike

 



jNizM
  • Members
  • 928 posts
  • Last active: Jan 12 2018 09:23 AM
  • Joined: 01 Aug 2012
example:

Gui, Margin, 10, 10
Gui, Add, Text, xm ym w80, Black Text
Gui, Font, cDA4F49
Gui, Add, Text, xm y+20 w80, Red Text
Gui, Font
Gui, Add, Text, xm y+20 w80, Black Text
Gui, Show, AutoSize

[AHK] 1.1.27.04 x64 Unicode | [WIN] 10 Pro (Version 1709)
My GitHub Profile | Donations are appreciated if I could help you

mikek
  • Members
  • 161 posts
  • Last active: Nov 09 2015 05:02 PM
  • Joined: 21 Nov 2008

Thank you, jNizM. Your example demonstrates how to add new text of different colors. However, do you know how to change the color of existing text?

 

I have already prepared a GUI. I have a text item which is black. I would like to change the color to red if certain conditions are met.

 

I appreciate your help with this.

 

- Mike



jNizM
  • Members
  • 928 posts
  • Last active: Jan 12 2018 09:23 AM
  • Joined: 01 Aug 2012
✓  Best Answer
Gui, Margin, 10, 10
Gui, Add, Text, xm ym w80, Black Text
Gui, Add, Text, xm y+20 w80 vRed, Black Text
Gui, Add, Text, xm y+20 w80, Black Text
Gui, Add, Button, xm y+20 w80 gRed, Red
Gui, Add, Button, x+10 yp w80 gBlack, Black
Gui, Show, AutoSize
return

Red:
    GuiControl, +cDA4F49, Red
    GuiControl,, Red, Red Text
return

Black:
    GuiControl, +c000000, Red
    GuiControl,, Red, Black Text
return

[AHK] 1.1.27.04 x64 Unicode | [WIN] 10 Pro (Version 1709)
My GitHub Profile | Donations are appreciated if I could help you

mikek
  • Members
  • 161 posts
  • Last active: Nov 09 2015 05:02 PM
  • Joined: 21 Nov 2008

This works. Thank you very much, jNizM. I appreciate it. Have a nice weekend.

 

- Mike