Click here to get your copy of REALbasic

Binding Buttons to a ListBox

Posted on September 22, 2009 
Filed Under REALbasic Tutorial | Leave a Comment

Back in the good ol’ days you could use a menu option to “bind” a pushbutton to a listbox which made it really easy to keep someone from clicking the button if there wasn’t a row selected in the listbox.

That feature no longer exists in REALbasic, but it’s really super-simple to bind a button to a listbox with a single short line of code.

In fact, the REALbasic video tutorial (link opens in a new window) for this tip is probably too long when compared to the code that’s written. =:)

New Site for Torque Game Builder

Posted on September 22, 2009 
Filed Under REALbasic Tutorial | Leave a Comment

My son and I are starting a new site for people who are programming games using Torque Game Builder. I’m still going to be doing more REALbasic videos, but my son is really into gaming and TGB is a really cool platform to build games together. =:)

Auto-Advance EditFields

Posted on April 5, 2009 
Filed Under REALbasic Tutorial | 1 Comment

Someone on the forum was asking how to make an editfield automatically tab to the next editfield when a maxChars limit was reached.

Even though the following video is a bit on the “rough” side, it explains at least one way to accomplish that.

Auto-Advanced EditFields (link opens in new window)

Sample code: Right-click for aaef-demo.zip

Wow, Long Time No Post!

Posted on February 27, 2009 
Filed Under REALbasic Tutorial | 1 Comment

Sheesh, time can get away from you. =:)

I’ve been so busy earning a living that I haven’t taken time to continue posting here — which is actually normal for the typical blog.

However, I’ve been continuing to code in RB and am gearing up for a series of tutorial videos, so hopefully within the next 2-4 weeks you’ll see new videos being posted.

Keep your fingers crossed! =:)

Jay

Dates for REAL World ‘09

Posted on April 10, 2008 
Filed Under REALbasic Tutorial | 1 Comment

REAL Software just sent out a newsletter and listed the dates of next year’s REAL World conference:

May 4-6, 2009

It’s cool that we know so far ahead of time…

…but it’s MORE than a whole year away! =:(

Well, make plans for it now — I’d like to meet you there!

Jay

My First Yuma Sample

Posted on April 6, 2008 
Filed Under REALbasic Tutorial | 3 Comments

I figure that since Yuma is REALbasic under the hood (kind of ) that it should be fair game for this blog. =:)

This morning, instead of going to bed like I ought, I stayed up and wrote my first Yuma code. It’s very simple, just opens a SQLite database and reads in some data, then prints it to the web page. No classes, functions, etc, just some straight-ahead code.

Here’s the first chunk of Yuma code that goes at the top of the page:

<?yuma
    dim srdata as SQLiteDatabase
    dim rs as RecordSet
    dim cnct as Boolean
    dim articles() as String

    srdata = New SQLiteDatabase

    srdata.DatabaseFile = GetFolderItem("aa.rsd")
    cnct = srdata.Connect
    rs = srdata.SQLSelect("select title from articles")
    while not rs.eof
        articles.Append rs.Field("title").StringValue
        rs.MoveNext
    wend
    srdata.Close
?>

One thing I want to mention right off the bat is this is NOT the way to write code — there’s no error- checking. But I wanted to make it as short as possible just to showcase the “good stuff.”

Just like regular RB code, you dimension your variables ahead of time, then create a FolderItem for the aa.rsd file, connect to the database, and finally get a RecordSet as the result of a SQL select statement.

Oh, the other thing I did there was instead of just printing out the data, I used Array.Append to fill the articles() array with the data — we’ll use it in the second chunk of code.

Here’s the second (and last) chunk of code — it’s the main part of the actual HTMP page:

<html>
<head><title>Yuma Database Sample</title></head>
<body>
    <p>
    <?yuma      
        dim x, numArticles as Integer
        numArticles = UBound(articles)
        for x = 0 to numArticles
            print str(x+1) + ". " + articles(x) + "<br/>"
        next
    ?>
    <p/>
</body>
</html>

Right inside the body of the page we have another Yuma code block that simply finds out how big the articles() array is and then loops over it to print the data to the screen.

That block of code is in just about the simplest HTML page you can create, but there’s nothing stopping it from being inside a big honkin’ prettified web page.

Just for the fun of it, you could even do something like this — break the block up so that it loops over the rows of a table:

<table width="600">
<?yuma      
    dim x, numArticles as Integer
    numArticles = UBound(articles)
    for x = 0 to numArticles
?>
    <tr>
        <td>
        <?yuma print str(x+1) + ". " + articles(x) + "<br/>" ?>
        </td>
    </tr>
<?yuma next ?>
</table>

Notice the “next” part of the for loop is in a different chunk of Yuma code — it doesn’t care, it still knows it belongs with the code above.

Put those two chunks of code on one .yuma page, make sure you have a database file called aa.rsd containing a table called articles and a column called title, and you’re in business!

If you haven’t download the development version of Yuma, get to it — it’s free and cross-platform.

I really wish I’d had Yuma last fall when I was porting a bunch of my REALbasic desktop apps to PHP. That silliness is going to stop now! =;)

More Money for REALbasic Programmers

Posted on March 29, 2008 
Filed Under REALbasic Tutorial | Leave a Comment

I put together a special report that went along with the presentation I gave at REAL World 2008 last week in Austin, Texas. That report is now available — and you can download it whether you went to RW ‘08 or not.

Programming Profits

If you’re interested in a way to make more money than just the traditional freelance programming route, you should get that special report.

ListBox Hover Cell

Posted on March 25, 2008 
Filed Under REALbasic Tutorial | 2 Comments

Here’s another REALbasic tip that could make your listboxes better…

Someone from the RB Forum asked how to know when the mouse is over the cell in a listbox. They wanted to show the original value in a static text as the mouse hovers over the cells in a certain column.

That’s a screenshot of the example program I put together that shows how to accomplish that (the cursor didn’t show in the screen capture, but it’s there pointing at the cell showing Eleven).

I did change the original poster’s requirements, though — I made a window that hovers show up rather than just putting the info in a static text control.

The “magic” that allows this to happen is ListBox.RowFromXY and ListBox.ColumnFromXY — it’s not rocket science after all! =:)

You can grab the sample source code for this REALbasic tutorial from here:

http://rbnation.com/files/ListBoxHoverCell2.zip

And then look in the ListBox.MouseMove event for the code to see what’s happening.

There have been times when I’ve wanted this kind of functionality, but never took the time to see what it would take to make it work. Who knew it would be so easy? =;)

Jay Jennings

PS – No video with this one, but more REALbasic tutorial videos are on the way.

Technorati Tags: ,

REAL World 2008

Posted on March 22, 2008 
Filed Under REALbasic Programming, REALbasic Tutorial | Leave a Comment

This isn’t a “wrap-up” or anything like that — I’m too wiped out to do that right now. But I will be posting more information about the conference that just ended a few hours ago.

Honestly, the only reason I came was due to winning the Speaker Contest REAL Software held — but now that I’ve seen what REAL World is all about, I’m kicking myself for not coming last year, and the year before, and…

I’m already planning on coming back next year.

There were some really good sessions but the absolute best part was meeting some of the best RB developers around the world — and the RS employees. I’d met Mars Saxman about 10 years ago (before RS existed) but it was nice seeing him again — and great meeting a lot of the RS people I only knew of as names in emails or in the forum.

One of the things this conference did was to light a fire under me and get some more REALbasic tutorial videos done — I have a list right now that I’m going to start working my way through as soon as I get back home on Monday.

So keep an eye on this spot — cool REALbasic code and stuff coming soon!

Jay Jennings

REALbasic Listbox – Drag-and-Drop

Posted on January 29, 2008 
Filed Under REALbasic Tutorial | Leave a Comment

Doing drag-and-drop between two listboxes is pretty easy with REALbasic — just use the sample code in the Language Reference manual. But if you want to drag and drop rows that have multiple columns, you’re going to need to add a little more code.

This video shows how easy that can be, and also takes a look at NthField and CountFields, two cool features in RB.

Multicolumn Listbox Dragging (link opens a new window)

Next Page →