<?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; tutorial</title>
	<atom:link href="http://realbasic.tutspolis.com/tag/tutorial/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>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>Drawing a picture in REALbasic ListBox control</title>
		<link>http://realbasic.tutspolis.com/tutorials/drawing-a-picture-in-realbasic-listbox-control/</link>
		<comments>http://realbasic.tutspolis.com/tutorials/drawing-a-picture-in-realbasic-listbox-control/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 21:11:58 +0000</pubDate>
		<dc:creator>Jakub Pawlak</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[drawing]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[listbox]]></category>
		<category><![CDATA[picture]]></category>
		<category><![CDATA[realbasic]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://realbasic.tutspolis.com/?p=96</guid>
		<description><![CDATA[<!-- isPostPurchased ,postID 96, userID 0, combination 1 -->
			
				
			
		
In this tutorial we will learn how can we easy draw a picture in REALbasic ListBox control and how can we get the text from double clicked row or column in this control. So run REALbasic and start reading. Watch it, learn it, enjoy it!


ListBox Control Setup
Add to your Window ListBox Control and set the [...]]]></description>
			<content:encoded><![CDATA[<!-- isPostPurchased ,postID 96, 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%2Fdrawing-a-picture-in-realbasic-listbox-control%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fdrawing-a-picture-in-realbasic-listbox-control%2F&amp;source=REALbasicCity&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>In this tutorial we will learn how can we easy draw a picture in REALbasic ListBox control and how can we get the text from double clicked row or column in this control. So run REALbasic and start reading. Watch it, learn it, enjoy it!</p>
<p><span id="more-96"></span></p>
<div style="margin-left:19px;float:left">
<h2>ListBox Control Setup</h2>
<p>Add to your Window ListBox Control and set the DefaultRowHeight property value to 32. Next prepare a 32&#215;32 picture (called tutspolis) and drag it to your Project Tab. </p>
<p><img src="http://realbasic.tutspolis.com/files/tutorials/listboxpicture/pictureinlistbox1.png" alt="Add a picture to REALbasic Project Tab" /></p>
<h2>Adding text to ListBox control</h2>
<p>In code editor go to ListBox Sub Open () and insert this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> i <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>
&nbsp;
<span style="color: #000080;">for</span> i = 1 <span style="color: #000080;">to</span> 5
  ListBox1.AddFolder <span style="color: #800000;">&quot;REALbasic City&quot;</span>
  ListBox1.Cell(Me.LastIndex, 1) = <span style="color: #800000;">&quot;F&quot;</span>
  ListBox1.AddFolder <span style="color: #800000;">&quot;REALbasic City 2&quot;</span>
  ListBox1.Cell(Me.LastIndex, 1) = <span style="color: #800000;">&quot;F&quot;</span>
<span style="color: #000080;">next</span>
&nbsp;
 Me.ColumnAlignmentOffset(0)= 35</pre></td></tr></table></div>

<h2>Drawing a graphic in ListBox</h2>
<p>In REALbasic code editor go to ListBox Function CellTextPaint () and use this code:</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;">if</span> column = 0 <span style="color: #000080;">then</span>
  <span style="color: #000080;">if</span> Me.cell(row,1) = <span style="color: #800000;">&quot;F&quot;</span> <span style="color: #000080;">then</span>
     g.DrawPicture(tutspolis,2,2)
  <span style="color: #000080;">else</span>
     g.DrawString <span style="color: #800000;">&quot;Fake Line&quot;</span>, 29,9
   <span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
<span style="color: #000080;">end</span> <span style="color: #000080;">if</span></pre></td></tr></table></div>

<h2>ListBox DoubleClick event</h2>
<p>Using this code in the ListBox Sub DoubleClick () event you can get the string, number of the cell, row that was double-clicked.</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;">Dim</span> row, column <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>
&nbsp;
row=Me.RowFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)
column=Me.ColumnFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)
&nbsp;
MsgBox <span style="color: #800000;">&quot;You double-clicked on &quot;</span>+ Me.list(row)</pre></td></tr></table></div>

<p><img src="http://realbasic.tutspolis.com/files/tutorials/listboxpicture/pictureinlistbox.png" alt="draw a picture in realbasic list box" /></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://realbasic.tutspolis.com/tutorials/drawing-a-picture-in-realbasic-listbox-control/feed/</wfw:commentRss>
		<slash:comments>5</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>
	</channel>
</rss>
