How to change some of TAT?

BlitzMax Forums/BlitzMax Programming/How to change some of TAT?

ozak(Posted 2006) [#1]
How do I make some text in a TextAreaText bold or cursive? Surely it can be done without changing the entire textareafont (which doesn't seem to work btw as it sets the font for the entire textarea).


Diablo(Posted 2006) [#2]
try this ozak, dont know all the falgs but 1 = bold, 2 = italic, 3 = b = i:
Global mywin:TGadget = CreateWindow("textarea test", 10, 10, 300, 300)

Global ta:TGadget = CreateTextArea(10, 10, 200, 200, mywin)
SetGadgetLayout ta, 1, 1, 1, 1

Global mybut1:Tgadget = CreateButton("Press", 10 + 200 + 5, 10, 60, 22, mywin)
SetGadgetLayout mybut1, 0, 1, 1, 0



AddHook EmitEventHook, MyHook

Repeat
	WaitEvent()
Forever
End

Function MyHook:Object(iId:Int,tData:Object,tContext:Object)

	Local Event:TEvent=TEvent(tData)
	
	Select event.id
	
	
		Case EVENT_WINDOWCLOSE
			If event.source = mywin Then End
			
		Case EVENT_GADGETACTION
			If event.source = mybut1 Then
			
				FormatTextAreaText(ta, 255, 0, 0, 1, TextAreaCursor(ta), TextAreaSelLen(ta))
			
			EndIf
	
	EndSelect

	Return tData
	
End Function