Color Textarea

BlitzPlus Forums/BlitzPlus Beginners Area/Color Textarea

Ked(Posted 2007) [#1]
Does anyone know how to keep the textarea active when a color requester is active? I am trying to select a color and, when its selected, color the textarea text from then on with the selected color. But it's not working.

Include "b+.bb"

window=CreateWindow("Color Textarea",80,80,400,300,Desktop(),1+2)
textarea=CreateTextArea(10,50,ClientWidth(window)-20,ClientHeight(window)-60,window,0)
SetGadgetLayout textarea,1,1,1,1

syntaxfont=LoadFont("verdana",18,True)
SetTextAreaFont textarea,syntaxfont

button=CreateButton("COLOR",10,5,50,40,window)
SetGadgetLayout button,1,0,1,0

Repeat
	
	Select WaitEvent()
		Case EVENT_WINDOWCLOSE
		Select EventSource()
			Case window
				End
		End Select
		
		Case EVENT_GADGETACTION
		Select EventSource()
			Case button
			r=RequestColor()
			
			If r=True
				txt$=TextAreaText$(textarea)
				red=RequestedRed()
				green=RequestedGreen()
				blue=RequestedBlue()
				curtext=TextAreaCursor(textarea,1)
				If curtext<>0
				
					LockTextArea textarea
						FormatTextAreaText textarea,red,green,blue,0,curtext,Len(txt$)
					UnlockTextArea textarea
				
				EndIf
			EndIf
		End Select
	End Select
	
Forever



Siopses(Posted 2007) [#2]
I'd help you out, but I can tell your not including all the code because of this:

If r=True
				txt$=TextAreaText$(textarea)
				red=RequestedRed()
				green=RequestedGreen()
				blue=RequestedBlue()
				curtext=TextAreaCursor(textarea,1)
				If curtext<>0



Ked(Posted 2007) [#3]
Uh... "r" is the pointer to RequestColor. It returns 1 or True if they select a color. The only thing I didn't post was the "b+.bb" include. But you don't need it. Just replace that with:
Const EVENT_WINDOWCLOSE = $803
Const EVENT_GADGETACTION = $401



Siopses(Posted 2007) [#4]
No, TextAreaCursor is a function you made right?


Ked(Posted 2007) [#5]
No, TextAreaCursor is a BlitzPlus function.


Siopses(Posted 2007) [#6]
Then how come it is not in my version? Is it in an update?


Ked(Posted 2007) [#7]
Um.. this is going to be a stupid thing to say, but be sure you're using BiltzPlus.

And, why aren't you updated to the latest anyway?


Siopses(Posted 2007) [#8]
I know I have Blitz Plus because I bought it! And that function does not exsist on my product.


kfprimm(Posted 2007) [#9]
http://www.blitzbasic.com/bpdocs/command.php?name=TextAreaCursor&ref=goto

someone should update once in a while! ;)