<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>REALbasic City &#187; textarea</title>
	<atom:link href="http://realbasic.tutspolis.com/tag/textarea/feed/" rel="self" type="application/rss+xml" />
	<link>http://realbasic.tutspolis.com</link>
	<description>Tutorials - Tutspolis.com</description>
	<lastBuildDate>Sat, 29 May 2010 23:10:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PM: REALbasic TextArea Syntax highlighting tutorial</title>
		<link>http://realbasic.tutspolis.com/tutorials/pm-realbasic-textarea-syntax-highlighting-tutorial/</link>
		<comments>http://realbasic.tutspolis.com/tutorials/pm-realbasic-textarea-syntax-highlighting-tutorial/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 00:06:41 +0000</pubDate>
		<dc:creator>Jakub Pawlak</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[highlighting]]></category>
		<category><![CDATA[realbasic]]></category>
		<category><![CDATA[syntax highlighting]]></category>
		<category><![CDATA[textarea]]></category>

		<guid isPermaLink="false">http://realbasic.tutspolis.com/?p=260</guid>
		<description><![CDATA[<!-- isPostPurchased ,postID 260, userID 0, combination 1 -->
			
				
			
		
Syntax highlighting is a feature of some text editors that display text-especially source code-in different colors and fonts according to the category of terms. Here is a nice and small starting point tutorial showing how can you create this kind of effect in REALbasic.


Creating the GUI for TextArea Syntax highlighting
Add to Window1 one TextField Control. [...]]]></description>
			<content:encoded><![CDATA[<!-- isPostPurchased ,postID 260, userID 0, combination 1 --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fpm-realbasic-textarea-syntax-highlighting-tutorial%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fpm-realbasic-textarea-syntax-highlighting-tutorial%2F&amp;source=REALbasicCity&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Syntax highlighting is a feature of some text editors that display text-especially source code-in different colors and fonts according to the category of terms. Here is a nice and small starting point tutorial showing how can you create this kind of effect in REALbasic.</p>
<p><span id="more-260"></span></p>
<div style="margin-left:19px;float:left">
<h2>Creating the GUI for TextArea Syntax highlighting</h2>
<p>Add to Window1 one TextField Control. Now go to TextField Sub () TextChange and enter some code&#8230; Before we start there are some things to clarify. First &#8211; this is only a starting point for creating inline text checking and it works only after typing. So I mean by this that there is no option to get for example to first line (after typing 10) and add some change to code (at least as expected). But as I mentioned earlier this is a good start tutorial, so you can create own REALbasic TextArea Syntax highlighting Class. Hope you will enjoy it!<br />
	<div class='ArePayPalContent'>
	<p class='ArePayPalTextToShowIfNotLogedIn'>If you see this message you probably want access special material for Premium Members (Source Files, Bonus Tutorials, free Classes and More). You can do this by subscribing REALbasic City site for 10 USD (access for 3 months). There is also a option to buy access only to this material. Login or register to get option to buy and support REALbasic City.</p>
	<a class='ArePayPalLoginButton' href='http://tutspolis.com/wp-login.php'>Log in</a>
	</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://realbasic.tutspolis.com/tutorials/pm-realbasic-textarea-syntax-highlighting-tutorial/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>REALbasic &#8211; StyledText Class</title>
		<link>http://realbasic.tutspolis.com/classes/realbasic-styledtext-class/</link>
		<comments>http://realbasic.tutspolis.com/classes/realbasic-styledtext-class/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 11:57:59 +0000</pubDate>
		<dc:creator>Jakub Pawlak</dc:creator>
				<category><![CDATA[Classes & Controls]]></category>
		<category><![CDATA[realbasic]]></category>
		<category><![CDATA[styledtext]]></category>
		<category><![CDATA[textarea]]></category>

		<guid isPermaLink="false">http://realbasic.tutspolis.com/?p=250</guid>
		<description><![CDATA[<!-- isPostPurchased ,postID 250, userID 0, combination 1 -->
			
				
			
		
The REALbasic StyledText Class enables you to apply style attributes to the TextArea Control. We can use it to create MS Word like application or syntax highlight for TextArea Control. Learn some basic about StyledText Class available in REALbasic.


StyledText Class in REALbasic
Because the TextArea already has selection style attributes, the StyledText class honors that information. [...]]]></description>
			<content:encoded><![CDATA[<!-- isPostPurchased ,postID 250, userID 0, combination 1 --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Frealbasic.tutspolis.com%2Fclasses%2Frealbasic-styledtext-class%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Frealbasic.tutspolis.com%2Fclasses%2Frealbasic-styledtext-class%2F&amp;source=REALbasicCity&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>The REALbasic StyledText Class enables you to apply style attributes to the TextArea Control. We can use it to create MS Word like application or syntax highlight for TextArea Control. Learn some basic about StyledText Class available in REALbasic.</p>
<p><span id="more-250"></span></p>
<div style="margin-left:19px;float:left">
<h2>StyledText Class in REALbasic</h2>
<p>Because the TextArea already has selection style attributes, the StyledText class honors that information. This means that you can set the style information using the selection methods that are available within the TextArea class, and they will be reflected when getting StyleRun information (and vice versa). Not all of the style attributes for selections in the TextArea class are available in the StyleRun class, such as Outline, Condense, Shadow, and Extend. These were supported only on Mac OS &#8220;classic&#8221;.</p>
<h2>StyledText Class example in REALbasic</h2>
<p>The following example uses the methods of the StyledText class to mark up and align text and display it in a TextArea. In order for the styled text to display, you must turn on the Multiline and Styled properties of the TextArea.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> Text <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>  // text <span style="color: #000080;">to</span> be displayed <span style="color: #000080;">in</span> TextArea
<span style="color: #000080;">Dim</span> st,ln <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>  // start <span style="color: #000080;">and</span> length values of a paragraph
&nbsp;
//define four paragraphs <span style="color: #000080;">in</span> Text
Text = <span style="color: #800000;">&quot;This is the text that we are going to save &quot;</span> _
+<span style="color: #800000;">&quot;into our file from the TextArea.&quot;</span>+EndofLine _
+<span style="color: #800000;">&quot;Isn't that interesting?&quot;</span>+EndofLine _
+<span style="color: #800000;">&quot;Man, I sure do love using RB to take care of my projects.&quot;</span>+EndofLine _
+<span style="color: #800000;">&quot;That's because the RS Engineering staff is just so awesome!&quot;</span>
&nbsp;
TextArea1.StyledText.Text = text //four paragraphs <span style="color: #000080;">in</span> Text
TextArea1.StyledText.Bold(5, 2) = <span style="color: #000080;">True</span>
TextArea1.StyledText.TextColor(5, 2) = &amp;cFF0000 //bold <span style="color: #000080;">and</span> red
TextArea1.StyledText.Size( 7, 10) = 16
TextArea1.StyledText.Underline(12, 4) = <span style="color: #000080;">True</span> //16 pt underline
TextArea1.StyledText.Size(100, 4) = 18
TextArea1.StyledText.TextColor(100, 4) = &amp;cFF00FF //18 pt <span style="color: #000080;">and</span> Magenta
TextArea1.StyledText.Font(0, Len(text) ) = <span style="color: #800000;">&quot;Comic Sans MS&quot;</span>
&nbsp;
//center aliign second paragraph
TextArea1.StyledText.ParagraphAlignment(1)=Paragraph.AlignCenter 
//<span style="color: #000080;">set</span> this paragraph <span style="color: #000080;">in</span> Helveticta, 18 pt bold, red
//first <span style="color: #000080;">get</span> the start <span style="color: #000080;">and</span> length values <span style="color: #000080;">for</span> this paragraph...
st=TextArea1.StyledText.Paragraph(1).StartPos
ln=TextArea1.StyledText.Paragraph(1).Length+1
&nbsp;
//<span style="color: #000080;">next</span> apply attributes...
TextArea1.StyledText.Bold(st,ln)=<span style="color: #000080;">True</span>
TextArea1.StyledText.Font(st,ln)=<span style="color: #800000;">&quot;Helvetica&quot;</span>
TextArea1.StyledText.Size(st,ln)=18
TextArea1.StyledText.TextColor(st,ln)=&amp;cFF0000</pre></td></tr></table></div>

<h2>Save StyledText to file in REALbasic</h2>
<p>The following code, appended to the end of the previous method, saves the styled text to disk in RTF format. It assumes that the File Type Set, &#8220;TextTypes&#8221; has one item, TextRTF, that defines the RTF file type</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> s <span style="color: #000080;">As</span> TextOutputStream
<span style="color: #000080;">Dim</span> f <span style="color: #000080;">As</span> Folderitem
&nbsp;
f=GetSaveFolderItem(TextTypes.TextRtf,<span style="color: #800000;">&quot;TestSaveRTF&quot;</span>)
s=TextOutputStream.Create(f)
s.Write TextArea1.StyledText.RTFData
s.<span style="color: #000080;">Close</span></pre></td></tr></table></div>

</div>
]]></content:encoded>
			<wfw:commentRss>http://realbasic.tutspolis.com/classes/realbasic-styledtext-class/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Working with text stream in REALbasic</title>
		<link>http://realbasic.tutspolis.com/tutorials/working-with-text-stream-in-realbasic/</link>
		<comments>http://realbasic.tutspolis.com/tutorials/working-with-text-stream-in-realbasic/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 20:15:48 +0000</pubDate>
		<dc:creator>Jakub Pawlak</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[binarystream]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[dialog]]></category>
		<category><![CDATA[load]]></category>
		<category><![CDATA[open]]></category>
		<category><![CDATA[realbasic]]></category>
		<category><![CDATA[save]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[textarea]]></category>

		<guid isPermaLink="false">http://realbasic.tutspolis.com/?p=139</guid>
		<description><![CDATA[<!-- isPostPurchased ,postID 139, userID 0, combination 1 -->
			
				
			
		
In this exciting tutorial we will learn some basics about saving, opening and convert encoding of text files in REALbasic using TextInputStream, TextOutputStream classes and ConvertEncoding function. Watch it, learn it, enjoy it!


Creating the GUI
Insert to Window Class one TextArea Control and 3 x PushButton Control. Here is my example of GUI look for this [...]]]></description>
			<content:encoded><![CDATA[<!-- isPostPurchased ,postID 139, userID 0, combination 1 --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fworking-with-text-stream-in-realbasic%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fworking-with-text-stream-in-realbasic%2F&amp;source=REALbasicCity&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>In this exciting tutorial we will learn some basics about saving, opening and convert encoding of text files in REALbasic using TextInputStream, TextOutputStream classes and ConvertEncoding function. Watch it, learn it, enjoy it!</p>
<p><span id="more-139"></span></p>
<div style="margin-left:19px;float:left">
<h2>Creating the GUI</h2>
<p>Insert to Window Class one TextArea Control and 3 x PushButton Control. Here is my example of GUI look for this application. You can make it the same or insert the controls where you like.</p>
<p><img src="http://realbasic.tutspolis.com/files/tutorials/textsaveopenconvert.png" alt="Working with text stream in REALbasic" /></p>
<h2>Save text to file</h2>
<p>To save all text available in TextArea to text file insert to PushButton1 Sub Open() this code. Please have in mind that you can save the file without interacting with user for example: f = GetFolderItem(&#8220;textfile.txt&#8221;)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> t <span style="color: #000080;">As</span> TextOutputStream
<span style="color: #000080;">Dim</span> f <span style="color: #000080;">As</span> FolderItem
<span style="color: #000080;">Dim</span> dlg <span style="color: #000080;">As</span> SaveAsDialog
&nbsp;
dlg = <span style="color: #000080;">New</span> SaveAsDialog 
&nbsp;
f = dlg.ShowModal() // <span style="color: #000080;">open</span> save <span style="color: #000080;">as</span> dialog <span style="color: #000080;">for</span> entering the file name <span style="color: #000080;">and</span> selecting location <span style="color: #000080;">to</span> save
&nbsp;
<span style="color: #000080;">if</span> f &lt; &gt; nil <span style="color: #000080;">then</span> // f different from nil
    t = f.CreateTextFile // create file <span style="color: #000080;">in</span> selected location
    t.Write (TextArea1.Text) // write <span style="color: #000080;">date</span> from TextArea <span style="color: #000080;">to</span> file
    t.<span style="color: #000080;">Close</span> // <span style="color: #000080;">close</span> file
<span style="color: #000080;">else</span>
    // user cancelled
<span style="color: #000080;">end</span> <span style="color: #000080;">if</span></pre></td></tr></table></div>

<h2>Open text from file</h2>
<p>To open a text file and load it content to TextArea Control use this code in PushButton2 Sub Open().</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> t <span style="color: #000080;">As</span> TextInputStream
<span style="color: #000080;">Dim</span> f <span style="color: #000080;">As</span> FolderItem
<span style="color: #000080;">Dim</span> dlg <span style="color: #000080;">As</span> OpenDialog
&nbsp;
dlg = <span style="color: #000080;">New</span> OpenDialog 
&nbsp;
f = dlg.ShowModal() // <span style="color: #000080;">open</span> <span style="color: #000080;">open</span> dialog <span style="color: #000080;">for</span> selecting a file <span style="color: #000080;">to</span> load
&nbsp;
<span style="color: #000080;">if</span> f &lt; &gt; nil <span style="color: #000080;">then</span> // f different from nil
    t = f.OpenAsTextFile // <span style="color: #000080;">open</span> selected text file
    TextArea1.Text = t.ReadAll // read data from text file into TextArea <span style="color: #000080;">control</span>
    t.<span style="color: #000080;">Close</span> // <span style="color: #000080;">close</span> the file
<span style="color: #000080;">else</span>
    // user cancelled
<span style="color: #000080;">end</span> <span style="color: #000080;">if</span></pre></td></tr></table></div>

<h2>Convert text encoding</h2>
<p>When you need to write text to a file that will be opened by other application that expects a particular encoding, you should convert the encoding before you call the Write method. You can do this by using ConvertEncoding function. Look on this example that converts the text from a TextArea1 to the UTF8 encoding. Code from PushButton3 Sub Open().</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> t <span style="color: #000080;">As</span> TextOutputStream
<span style="color: #000080;">Dim</span> f <span style="color: #000080;">As</span> FolderItem
<span style="color: #000080;">Dim</span> dlg <span style="color: #000080;">As</span> SaveAsDialog
<span style="color: #000080;">Dim</span> s <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>
&nbsp;
dlg = <span style="color: #000080;">New</span> SaveAsDialog 
&nbsp;
f = dlg.ShowModal() // <span style="color: #000080;">open</span> save <span style="color: #000080;">as</span> dialog <span style="color: #000080;">for</span> entering the file name <span style="color: #000080;">and</span> selecting location <span style="color: #000080;">to</span> save
&nbsp;
<span style="color: #000080;">if</span> f &lt; &gt; nil <span style="color: #000080;">then</span> // f different from nil
    t = f.CreateTextFile // create file <span style="color: #000080;">in</span> selected location
    s = ConvertEncoding(TextArea1.Text, Encodings.UTF8) // convert encoding <span style="color: #000080;">to</span> UTF8
    t.Write (s) // write <span style="color: #000080;">date</span> from <span style="color: #000080;">string</span> <span style="color: #000080;">to</span> file
    t.<span style="color: #000080;">Close</span> // <span style="color: #000080;">close</span> file
<span style="color: #000080;">else</span>
    // user cancelled
<span style="color: #000080;">end</span> <span style="color: #000080;">if</span></pre></td></tr></table></div>

<h2>BinaryStream Class</h2>
<p>BinaryStream objects are used to read and write data to and from a binary file. The benefit of using BinaryStreams rather than text streams is that you can read from and write to any position in the file. Text files must be read sequentially from the start to the end. On Windows and Macintosh only, BinaryStream objects can work with files larger than 2 gigabytes. This example reads each pair of bytes from a file and writes them in reverse order to a new file. The user chooses the source file using the Open-file dialog box and saves the new file using the Save as dialog box</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> WriteToFile <span style="color: #000080;">as</span> BinaryStream
<span style="color: #000080;">Dim</span> ReadFromFile <span style="color: #000080;">as</span> BinaryStream
<span style="color: #000080;">Dim</span> f <span style="color: #000080;">as</span> FolderItem
&nbsp;
f = GetOpenFolderItem(<span style="color: #800000;">&quot;text&quot;</span>)
&nbsp;
<span style="color: #000080;">if</span> f &lt; &gt; nil <span style="color: #000080;">then</span> // <span style="color: #000080;">if</span> f different nil <span style="color: #000080;">then</span>
ReadFromFile = BinaryStream.<span style="color: #000080;">Open</span> (f,<span style="color: #000080;">False</span>)
ReadFromFile.littleEndian = <span style="color: #000080;">True</span>
f = GetSaveFolderItem (<span style="color: #800000;">&quot;&quot;</span>,<span style="color: #800000;">&quot;&quot;</span>)
&nbsp;
<span style="color: #000080;">if</span> f &lt; &gt; nil <span style="color: #000080;">then</span> // <span style="color: #000080;">if</span> f different nil <span style="color: #000080;">then</span>
WriteToFile = BinaryStream.Create (f,<span style="color: #000080;">False</span>)
<span style="color: #000080;">while</span> <span style="color: #000080;">not</span> ReadFromFile.EOF
WriteToFile.WriteShort ReadFromFile.ReadShort
wend
WriteToFile.<span style="color: #000080;">Close</span>
<span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
ReadFromFile.<span style="color: #000080;">Close</span>
<span style="color: #000080;">end</span> <span style="color: #000080;">if</span></pre></td></tr></table></div>

</div>
]]></content:encoded>
			<wfw:commentRss>http://realbasic.tutspolis.com/tutorials/working-with-text-stream-in-realbasic/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Drag and drop images, text, controls in REALbasic</title>
		<link>http://realbasic.tutspolis.com/tutorials/drag-and-drop-images-text-controls-in-realbasic/</link>
		<comments>http://realbasic.tutspolis.com/tutorials/drag-and-drop-images-text-controls-in-realbasic/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 16:16:02 +0000</pubDate>
		<dc:creator>Jakub Pawlak</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[controls]]></category>
		<category><![CDATA[drag and drop]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[realbasic]]></category>
		<category><![CDATA[statictext]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[textarea]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://realbasic.tutspolis.com/?p=100</guid>
		<description><![CDATA[<!-- isPostPurchased ,postID 100, userID 0, combination 1 -->
			
				
			
		
In this tutorial we learn how to drag and drop images and text files from desktop to our application, and how to drag and drop controls inside Window in REALbasic. Watch it, learn it, enjoy it!


Creating the GUI
We will use today a StaticText, TextArea and Canvas control to create our GUI. Simply drag and drop [...]]]></description>
			<content:encoded><![CDATA[<!-- isPostPurchased ,postID 100, userID 0, combination 1 --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fdrag-and-drop-images-text-controls-in-realbasic%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fdrag-and-drop-images-text-controls-in-realbasic%2F&amp;source=REALbasicCity&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>In this tutorial we learn how to drag and drop images and text files from desktop to our application, and how to drag and drop controls inside Window in REALbasic. Watch it, learn it, enjoy it!</p>
<p><span id="more-100"></span></p>
<div style="margin-left:19px;float:left">
<h2>Creating the GUI</h2>
<p>We will use today a StaticText, TextArea and Canvas control to create our GUI. Simply drag and drop this controls to Window1 so they will be placed to something similar to the picture below.</p>
<p><img src="http://realbasic.tutspolis.com/files/tutorials/draganddrop/draganddrop.png" alt="Drag and drop in REALbasic" /></p>
<h2>Drag and drop controls</h2>
<p>The firs thing we will do in this tutorial is dragging a StaticText control to TextArea control and displaying in it StaticText1.Text. To do this go to StaticText1 Function MouseDown () and use this code.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> d <span style="color: #000080;">As</span> DragItem
&nbsp;
d = NewDragItem(me.left,me.top,me.width,me.height)
d.text = me.text
d.drag</pre></td></tr></table></div>

<p>Now you can drag and drop StaticText to TextArea control. Isn&#8217;t this easy or what?</p>
<h2>Drag and drop text file from desktop into TextArea</h2>
<p>In this part of tutorial we will learn how can we drag and drop text file from desktop to our REALbasic application. In this case we will use TextArea control as a object into we will drag and drop text file and display all content in it available.  Firs go to Project tab and add new File type set and as Display Name type special/any.</p>
<p><img src="http://realbasic.tutspolis.com/files/tutorials/draganddrop/filetypeset.png" alt="File type set in REALbasic" /></p>
<p>Next go to code editor and in TextArea1 Sub Open () enter code&#8230; Of course you can be more detailed by allowing only a specify format for drag and drop in this control.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">me.AcceptFileDrop(<span style="color: #800000;">&quot;special/any&quot;</span>)</pre></td></tr></table></div>

<p>We will create a Drag and drop event in TextArea1 Sub DropObject ()</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> text <span style="color: #000080;">As</span> TextInputStream
<span style="color: #000080;">Dim</span> f <span style="color: #000080;">As</span> FolderItem
&nbsp;
<span style="color: #000080;">do</span>
   <span style="color: #000080;">if</span> obj.FolderItemAvailable <span style="color: #000080;">then</span>
&nbsp;
    f = obj.FolderItem
&nbsp;
      <span style="color: #000080;">if</span> f &lt; &gt;  Nil <span style="color: #000080;">then</span> // f various Nil
        text =  f.OpenAsTextFile
        TextArea1.Text = text.ReadAll
        text.<span style="color: #000080;">close</span>
    <span style="color: #000080;">else</span>
        //User Cancelled
    <span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
&nbsp;
  <span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
<span style="color: #000080;">loop</span> <span style="color: #000080;">until</span> <span style="color: #000080;">not</span> obj.NextItem</pre></td></tr></table></div>

<p>As you can imagine if you will now drag and drop a text file to this control it will read and display the text inside the text file.</p>
<h2>Drag and drop image file from desktop into Canvas</h2>
<p>Getting a picture or graphic from desktop (or should say from hard drive) into Canvas using drag and drop method is similar to previous paragraph. Go to code editor and in Canvas1 Sub Open () enter code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">me.AcceptFileDrop(<span style="color: #800000;">&quot;special/any&quot;</span>)</pre></td></tr></table></div>

<p>Create a Drag and drop event in Canvas1 Sub DropObject ()</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> f <span style="color: #000080;">As</span> FolderItem
<span style="color: #000080;">Dim</span> p <span style="color: #000080;">As</span> Picture
&nbsp;
<span style="color: #000080;">do</span>
  <span style="color: #000080;">if</span> obj.FolderItemAvailable <span style="color: #000080;">then</span>
    f = obj.FolderItem
&nbsp;
    <span style="color: #000080;">if</span> f &lt; &gt;  Nil <span style="color: #000080;">then</span> // f various Nil
        p = f.OpenAsPicture  // load picture <span style="color: #000080;">to</span> memory
        Canvas1.Backdrop = p // load image from memory <span style="color: #000080;">to</span> canvas
    <span style="color: #000080;">else</span>
        //User Cancelled
    <span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
&nbsp;
  <span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
<span style="color: #000080;">loop</span> <span style="color: #000080;">until</span> <span style="color: #000080;">not</span> obj.NextItem</pre></td></tr></table></div>

<p>If you like you can add to this project some image manipulation techniques like fit to canvas, crop etc. from tutorial <a href="http://realbasic.tutspolis.com/tutorials/creating-imageviewer-in-realbasic/">Creating ImageViewer in REALbasic</a>.  See you next time!</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://realbasic.tutspolis.com/tutorials/drag-and-drop-images-text-controls-in-realbasic/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Creating text scrolling effect in REALbasic</title>
		<link>http://realbasic.tutspolis.com/tutorials/creating-text-scrolling-effect-in-realbasic/</link>
		<comments>http://realbasic.tutspolis.com/tutorials/creating-text-scrolling-effect-in-realbasic/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 19:18:31 +0000</pubDate>
		<dc:creator>Jakub Pawlak</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[realbasic]]></category>
		<category><![CDATA[text scrolling]]></category>
		<category><![CDATA[textarea]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[tutspolis]]></category>

		<guid isPermaLink="false">http://realbasic.tutspolis.com/?p=88</guid>
		<description><![CDATA[<!-- isPostPurchased ,postID 88, userID 0, combination 1 -->
			
				
			
		
This tutorial will show you how can you create a basic text scrolling effect similar to credits available in Firefox about window. To make it easy we will use here a Time and TextArea Controls. Watch it, learn it, enjoy it!


Creating the About Window
Go to Window1 Property panel and configure this values: Width: 308, Height: [...]]]></description>
			<content:encoded><![CDATA[<!-- isPostPurchased ,postID 88, userID 0, combination 1 --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fcreating-text-scrolling-effect-in-realbasic%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fcreating-text-scrolling-effect-in-realbasic%2F&amp;source=REALbasicCity&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>This tutorial will show you how can you create a basic text scrolling effect similar to credits available in Firefox about window. To make it easy we will use here a Time and TextArea Controls. Watch it, learn it, enjoy it!</p>
<p><span id="more-88"></span></p>
<div style="margin-left:19px;float:left">
<h2>Creating the About Window</h2>
<p>Go to Window1 Property panel and configure this values: Width: 308, Height: 372, BackColor: true, BackColor: &amp;cFFFFFF, Resizeable: false. Insert to the Window a Canvas Control and as Backdrop use the graphics you like. Now insert on Windows TextArea Control and configure this values: Top: 376, Width: 308, Height: 173, ScrollbarHorizontal: false, Border: false, BackColor: &amp;cFFFFFF, Enabled: false and insert in Text 10 positions. If you like have more data there you should increase some values (Height, Top).</p>
<p><img src="http://realbasic.tutspolis.com/files/tutorials/textscrolling/textscrolling.png" alt="text scrolling effect in realbasic" /></p>
<h2>Text scrolling effect</h2>
<p>Add to Window Time Control and in Property panel change Period property value to 10. Now double click on Timer icon in Window1 (you are now in Timer Sub Action()) and copy this code.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">TextArea1.Top = TextArea1.Top - 1 // scrolling the text up
&nbsp;
<span style="color: #000080;">if</span> TextArea1.Top = -50 <span style="color: #000080;">then</span> // <span style="color: #000080;">if</span> text position top <span style="color: #000080;">is</span> -50
    TextArea1.Top = 376 // <span style="color: #000080;">then</span> begin scrolling text again
<span style="color: #000080;">end</span></pre></td></tr></table></div>

<p>This is a very basic conception of creating this kind of text scrolling effect. If you are more advanced you can for example create a dynamic picture displayed on canvas control and scrolling it up. The effect will be similar. </p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://realbasic.tutspolis.com/tutorials/creating-text-scrolling-effect-in-realbasic/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Accepting License Agreement</title>
		<link>http://realbasic.tutspolis.com/tutorials/accepting-license-agreement/</link>
		<comments>http://realbasic.tutspolis.com/tutorials/accepting-license-agreement/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 16:24:47 +0000</pubDate>
		<dc:creator>Jakub Pawlak</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[ealbasic]]></category>
		<category><![CDATA[license agreement]]></category>
		<category><![CDATA[pushbutton]]></category>
		<category><![CDATA[scrollbar]]></category>
		<category><![CDATA[textarea]]></category>

		<guid isPermaLink="false">http://realbasic.tutspolis.com/?p=86</guid>
		<description><![CDATA[<!-- isPostPurchased ,postID 86, userID 0, combination 1 -->
			
				
			
		
Every software has got a License Agreement. In this tutorial we will learn how can we check if the user has scroll down to the end of license agreement. This way we will give us a theoretical chance that the user has reeded our license before accepting it. Watch it, learn it, enjoy it!


Creating the [...]]]></description>
			<content:encoded><![CDATA[<!-- isPostPurchased ,postID 86, userID 0, combination 1 --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Faccepting-license-agreement%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Faccepting-license-agreement%2F&amp;source=REALbasicCity&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Every software has got a License Agreement. In this tutorial we will learn how can we check if the user has scroll down to the end of license agreement. This way we will give us a theoretical chance that the user has reeded our license before accepting it. Watch it, learn it, enjoy it!</p>
<p><span id="more-86"></span></p>
<div style="margin-left:19px;float:left">
<h2>Creating the GUI</h2>
<p>Add to our Window one TextArea, one PushButton and one Timer control. In TextArea property Text put for example GNU GPL License Agreement. Now to the property Enabled of PushButton type false. You can do this by clicking on PushButton control and in Property Panel find and disable Enabled property. </p>
<p><img src="http://realbasic.tutspolis.com/files/tutorials/license/softwarelicense.png" alt="software license scroll down checker" /></p>
<h2>Checking the end of ScrollBar position</h2>
<p>In this part of tutorial we will create a Action in Timer control to check if the user has scroll to the end of License Agreement. If he has we will active the PushButton for next action. Double click on Timer1 control and use this code below:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">if</span> TextArea1.ScrollPosition = 456 <span style="color: #000080;">then</span>
    PushButton1.Enabled = <span style="color: #000080;">True</span>
    Timer1.Enabled = <span style="color: #000080;">False</span>
<span style="color: #000080;">else</span>
    PushButton1.Enabled =  <span style="color: #000080;">False</span>
<span style="color: #000080;">end</span> <span style="color: #000080;">if</span></pre></td></tr></table></div>

<p>How we know that 456 is the end of our TextArea.ScrollPosition? The License Agreement has got always the same length so we have easier task. We can  check the end of scroll position in TextArea1 with this code (create a new PushButton and when you scroll to the end of TextArea1 click on it).</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">msgBox = <span style="color: #000080;">CStr</span>(TextArea1.ScrollPosition)</pre></td></tr></table></div>

<p>OK, but somebody can ask how can we get the end of text available in TextArea1 when we don&#8217;t know the length of string inside it. The answer is easy:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">msgBox = <span style="color: #000080;">CStr</span>(TextArea1.LineNumAtCharPos(TextArea1.Text.Len) + 2)</pre></td></tr></table></div>

<p>Of course every code from this tutorial can be used in Windows, Linux and Mac OS version of REALbasic. I use Mac OS and I prefer it to show my tutorials. REALbasic is cross-platform and you can use your favourite system to create great applications in this IDE. </p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://realbasic.tutspolis.com/tutorials/accepting-license-agreement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>REALbasic – TextArea Control</title>
		<link>http://realbasic.tutspolis.com/classes/realbasic-textarea-control/</link>
		<comments>http://realbasic.tutspolis.com/classes/realbasic-textarea-control/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 08:51:14 +0000</pubDate>
		<dc:creator>Jakub Pawlak</dc:creator>
				<category><![CDATA[Classes & Controls]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[realbasic]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[textarea]]></category>

		<guid isPermaLink="false">http://realbasic.tutspolis.com/?p=68</guid>
		<description><![CDATA[<!-- isPostPurchased ,postID 68, userID 0, combination 1 -->
			
				
			
		
TextArea control is a editable text area that you are using in text editors (notepad, word, openoffice, pages etc.) or IM. It can contain multiple lines of text and can display mixed fonts, font styles and sizes. Learn how can you use it!


Adding text to a TextArea
Add to the Window PushButton Control and double click [...]]]></description>
			<content:encoded><![CDATA[<!-- isPostPurchased ,postID 68, userID 0, combination 1 --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Frealbasic.tutspolis.com%2Fclasses%2Frealbasic-textarea-control%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Frealbasic.tutspolis.com%2Fclasses%2Frealbasic-textarea-control%2F&amp;source=REALbasicCity&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>TextArea control is a editable text area that you are using in text editors (notepad, word, openoffice, pages etc.) or IM. It can contain multiple lines of text and can display mixed fonts, font styles and sizes. Learn how can you use it!</p>
<p><span id="more-68"></span></p>
<div style="margin-left:19px;float:left">
<h2>Adding text to a TextArea</h2>
<p>Add to the Window PushButton Control and double click on it. Then enter there the code below. It&#8217;s simply like in TextField.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">TextArea.Text = <span style="color: #800000;">&quot;REALbasic City sample text&quot;</span></pre></td></tr></table></div>

<h2>Reading text from a TextArea</h2>
<p>Reading the content from TextArea is extreme easy like this s = TextArea.Text. Here you got a example that shows Message Box:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> s <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>
<span style="color: #000080;">Dim</span> d <span style="color: #000080;">as</span> <span style="color: #000080;">New</span> MessageDialog //<span style="color: #000080;">declare</span> the MessageDialog <span style="color: #000080;">object</span>
<span style="color: #000080;">Dim</span> b <span style="color: #000080;">as</span> MessageDialogButton //handling the result
&nbsp;
s = TextArea.Text
d.Message = s
b = d.ShowModal</pre></td></tr></table></div>

<h3>Changing selected text in TextArea</h3>
<p>Every text editor has a option to change the style of the text. Here you can look how you can simple change the selected text in TextArea control to new color and new font with bold style. Add the code to PushButton Sub Action()</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> Black <span style="color: #000080;">As</span> Color
&nbsp;
Black = RGB(0,0,0)
&nbsp;
TextArea.SelTextFont = <span style="color: #800000;">&quot;Arial&quot;</span>
TextArea.SelBold = <span style="color: #000080;">true</span>
TextArea.SelTextColor = Black</pre></td></tr></table></div>

<h2>Changing string with TextArea</h2>
<p>We can also change the text in string ex. by finding the word or by putting the cursor on indicated line. We will change the word &#8220;my&#8221; form text string by putting the cursor on 8 position and changing the next 2 letters to bold and red color.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> text <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>
&nbsp;
text = <span style="color: #800000;">&quot;This is my string&quot;</span>
&nbsp;
TextArea.StyledText.Text = text
&nbsp;
TextArea.StyledText.Bold( 8, 2 ) = <span style="color: #000080;">true</span>
TextArea.StyledText.TextColor( 8, 2 ) = &amp;amp;cFF0020</pre></td></tr></table></div>

<h2>Using Mask</h2>
<p>Simply select TextArea in GUI builder Tab and then in Property and Value find Behavior -&gt; Mask and place there ex. ###-##-####. You can also add a code in TextArea Sub Open(). Go to Window1 code editor Controls -&gt; TextArea -&gt; Open.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">TextArea.Mask = <span style="color: #800000;">&quot;###-##-####&quot;</span> //US Social Security number
TextArea.Mask = <span style="color: #800000;">&quot;(###) ###-####&quot;</span> //US Phone number, <span style="color: #000080;">with</span> area code</pre></td></tr></table></div>

<h2>Mask Character in TextArea</h2>
<ul>
<b>#</b> &#8211; The single digit placeholder. Entry optional. If this position is left blank in the mask, it will be rendered as a space. Plus and minus signs are allowed. The user can type only a digit character in this position.<br />
<b>.</b> &#8211; Decimal placeholder. The decimal placeholder that is actually used is specified in the user&#8217;s International settings. The character is treated as a literal (formatting) character for masking purposes.<br />
<b>,</b> &#8211; Thousands separator. The thousands separator that is actually used is specified in the user&#8217;s International settings. The character is treated as a literal (formatting) character for masking purposes.<br />
<b>:</b> &#8211; Time separator. The time separator that is actually used is specified in the user&#8217;s International settings. The character is treated as a literal (formatting) character for masking purposes.<br />
<b>/</b> &#8211; Date separator. The date separator that is actually used is specified in the user&#8217;s International settings. The character is treated as a literal (formatting) character for masking purposes.<br />
<b>\</b> &#8211; Mask escape character. Treat the next character in the mask as a literal. The escape character enables you to use the &#8216;#&#8217;, &#8216;&amp;&#8217;, &#8216;A&#8217;, &#8216;?&#8217; (and so on) characters in the mask. The escapted character is treated as a literal (formatting) character.<br />
<b>&amp;</b> Character or space placeholder. Valid values are the ASCII characters 32-126 and the non-ASCII characters 128-255.<br />
<b>C</b> &#8211; Character or space placeholder, where entry is optional. It operates like the &#8216;&amp;&#8217; placeholder.<br />
<b>&gt;</b> &#8211; Convert all the characters that follow to uppercase. Uppercasing works beyond the ASCII range where appropriate, e.g., ü becomes Ü.<br />
<b>&lt;</b> &#8211; Convert all the characters that follow to lowercase. Lowercasing works beyond the ASCII range where appropriate, e.g., Ü becomes ü.<br />
<b>A</b> &#8211; Alphanumeric character placeholder, where entry is mandatory.<br />
For example, the spec &#8220;AAA&#8221; specifies three alphanumeric characters.<br />
<b>a</b> -Alphanumeric character placeholder, where entry is optional.<br />
<b>0</b> &#8211; Any single digit between 0 and 9. Entry is required.<br />
<b>9</b> &#8211; Digit or space where entry is optional.<br />
<b>?</b> &#8211; Alphabetic placeholder. Entry is optional.<br />
<b>L</b> &#8211; Alphabetic placeholder. Entry is required. Any literal. All other symbols are displayed as literals for formatting purposes.<br />
<b>~</b> &#8211; Reserved for future use. If you use &#8220;~&#8221; it will trigger an exception error. Use \~ instead.
</ul>
<h2>Using TextArea Property and Value</h2>
<p>When you select TextArea in GUI builder you can change some Property and Value for this control. We have got there position properties (width, height), appearance (text color, border), font (text size, text font), initial state (default text), behaviors (mask, read only) or database binding. Please play with them for a wile to understand what is happening when you change the values.
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://realbasic.tutspolis.com/classes/realbasic-textarea-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
