Copy and paste

BlitzPlus Forums/BlitzPlus Programming/Copy and paste

code(Posted 2004) [#1]
As Some might know I am new to B+ and as my first project I am making an IDE. I want to have a copy and paste feature in the menu, but cannot figure out how to put the text in the text field in to the clipboard. I have the menu written I just need to know how to make the menu item work.
Thanks


Eikon(Posted 2004) [#2]
http://www.blitzbasic.com/codearcs/codearcs.php?code=699


code(Posted 2004) [#3]
Thanks agian. I am now working on trying to clear the text field when opening a file, it'll open a file and all, but it just adds it to the end of the currently opend one at the moment, but I have only been trying for a few minutes.


Nebula(Posted 2004) [#4]
Setgadgettext gad,""


code(Posted 2004) [#5]
that still didn't work.
heres my code:
Select event
	Case 1
		Notify "you selected new"
	
	Case 2
			filelocation$ = RequestFile("Open a File","bb,cpp,crx,c,h,hpp,b3d,doc,txt,htm,html")
			file = ReadFile(filelocation$)
			
			SetGadgetText(codearea,"")
			
			
			While Not Eof(file)
				tmp1$ = ReadLine(file)
				tmp2$ = tmp2$ +Chr$(13)+tmp1$
			Wend
			AddTextAreaText(codearea,tmp2$)
			CloseFile(file)
	Case 4
			filedir$ = RequestFile("Save Your Script","",True)
			file = WriteFile(filedir$)
			WriteString(file,code)
			CloseFile(file)
	
	Case 6
		End
	End Select
EndIf

Forever

Well part of it. Case 2 is where the open file code is.


Nebula(Posted 2004) [#6]
Did you clear all obsolete variables before reloading?

If you keep data inside tmp2$ it will add the previous loaded text.


code(Posted 2004) [#7]
	Case 2
			filelocation$ = RequestFile("Open a File","bb,cpp,crx,c,h,hpp,b3d,doc,txt,htm,html")
			file = ReadFile(filelocation$)
			
			SetGadgetText(codearea,"")
			
			
			While Not Eof(file)
				tmp1$ = ReadLine(file)
				tmp2$ = tmp2$ +Chr$(13)+tmp1$
			Wend
			AddTextAreaText(codearea,tmp2$)
			tmp2$ = "" 
			CloseFile(file)

That works now, but it adds a space at the top. I know this is like a really simple bug, but i just can't find it.


Nebula(Posted 2004) [#8]
You are adding a chr(13) at the top before the first line is added.
You can fix it by placing tmp2$ = readline(file) above the while nof eof(file) line.


code(Posted 2004) [#9]
Yeah thanks! [url]http://www.s94678232.onlinehome.us/Downloads/crxide.rar[/url]
That is the download link for the 2nd alpha build.