Sign in to follow this  
Followers 0
d0n

gui Edit text different colors?

12 posts in this topic

is it possible to make the edit box show different color of text?

Example

Apple(In red)

Banana(In yellow)

all in one edit box?

GUICtrlsetcolor only changes the color for the whole edit box

Share this post


Link to post
Share on other sites



You're looking for a rich edit control. Search the Example forum.

Share this post


Link to post
Share on other sites

There are a lot of ways, but not easy ways. Richedits will be the easiest, and there are some UDF's in example scripts on that.

one way i'm looking at is creating an internet explorer object, disable it, add a label on top that when clicked focuses a hidden edit, that when changed updates the html source of the ie object.

I practically gave up on this very soon after starting, as I have no need for something this complex.

Overlays could also be used, but good luck with that :)

Mat

Share this post


Link to post
Share on other sites

I got it to work, but the color seems to be off

Using autoit window info i get the color i want to be 0x35ADFF

_GUICtrlRichEdit_SetBold($Label, True, True)
_GUICtrlRichEdit_SetFontColor($Label, 0x35ADFF, True)
_GUICtrlRichEdit_AppendText($Label, $Text[$a]&@CRLF)

Using this code and taking the color again, comes out an orange hue with this 0xFFAD35

Share this post


Link to post
Share on other sites

d0n,

i want to be 0x35ADFF

comes out...0xFFAD35

My instant thought was a BGR vs. RGB clash. A search for _GUICtrlRichEdit_SetFontColor found this:

Function Name: _GUICtrlRichEdit_SetFontColor

; Description: Select the text color

; Parameters : $hWnd - Handle to the control

; $hColor - Color value (BGR)

So the answer is simple - put your colour in BGR form and all will be well - or rewrite the function to use RGB! :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Mat,

Feeling generous today? :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Yeah, right.

Mat's fixed:

ConsoleWrite(_BgrtoRgb(BinaryToString("0x4265657028313034372C353632294265657028313332392C333735294265657028313438302C333735294265657028313736302C313838294265657028313536382C353632294265657028313332392C333735294265657028313034372C33373529")) & @CRLF)


Func _BgrtoRgb ($In, $bPrefix = True)
   Local $ret = "0x"
   If Not $bPrefix Then $ret = ""
   $In = Hex (Execute ($In), 6) ; << makes sure you can enter whatever and itll work
   Return $ret & StringRight ($In, 2) & StringMid ($In, 3, 2) & StringLeft ($In, 2)
EndFunc ; ==> _BgrtoRgb

Is that ok?


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

thanks, just changed it to BGR in the autoit info window to get it :)

Share this post


Link to post
Share on other sites

Yeah, right.

Can't be too helpful can i :), it was just copied code that wasn't copied perfectly...

Mat

Share this post


Link to post
Share on other sites

Can't be too helpful can i :), it was just copied code that wasn't copied perfectly...

Mat

I commented part of that function that was yours, not copied.

♡♡♡

.

eMyvnE

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  
Followers 0