Have a look at this example I knocked up as a test:
' FormatTextAreaText - example Strict Local win:TGadget=CreateWindow("FormatTextAreaText - example",80,90,378,320,Null,WINDOW_TITLEBAR) Local ta:TGadget=CreateTextArea(8,8,352,216,win,TEXTAREA_WORDWRAP) Local btnNORMAL:TGadget=CreateButton("Normal",8,232,64,24,win,1) Local btnBOLD:TGadget=CreateButton("Bold",80,232,64,24,win,1) Local btnITALIC:TGadget=CreateButton("Italic",152,232,64,24,win,1) Local btnBOLDITALIC:TGadget=CreateButton("Bold + Italic",224,232,136,24,win,1) Local btnCOLOR:TGadget=CreateButton("Color",8,264,208,24,win,1) Local btnRESET:TGadget=CreateButton("Restore text",224,264,136,24,win,1) SetTextAreaFont ta,LoadGuiFont("tahoma",12) SetGadgetText ta,"Select parts of this text and click buttons below" SetTextAreaColor ta,255,255,255,1 SetTextAreaColor ta,0,0,0,0 Const NORMAL=0,BOLD=1,ITALICS=2 ' ======= Repeat Select WaitEvent() Case EVENT_GADGETACTION Local taPOS=TextAreaCursor(ta) Local taLEN=TextAreaSelLen(ta) Select EventSource() Case btnNORMAL FormatTextAreaText ta,0,0,0,NORMAL,taPOS,taLEN Case btnBOLD FormatTextAreaText ta,0,0,0,BOLD,taPOS,taLEN Case btnITALIC FormatTextAreaText ta,0,0,0,ITALICS,taPOS,taLEN Case btnBOLDITALIC FormatTextAreaText ta,0,0,0,BOLD+ITALICS,taPOS,taLEN Case btnCOLOR Local rgb=RequestColor(0,0,0) Local r,g,b r=RequestedRed() ; g=RequestedGreen() ; b=RequestedBlue() FormatTextAreaText ta,r,g,b,NORMAL,taPOS,taLEN Case btnRESET FormatTextAreaText ta,0,0,0,NORMAL SelectTextAreaText ta,0,0 End Select Case EVENT_WINDOWCLOSE Exit End Select Forever End