Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 14.1 ('Barcodes')
Instant purchase and download via GumRoad!

COLUMN

Column

Issue: 14.1 (January/February 2016)
Author: Markus Winter
Author Bio: Markus is a Molecular Biologist who taught himself REALbasic programming in 2003 to let the computer deal with some exceedingly tedious lab tasks. Some call it lazy, he thinks it smart. He still thinks of himself as an advanced beginner at best.
Article Description: >No description available
Article Length (in bytes): 16,200
Starting Page Number: >9
Article Number: 14114
Related Link(s): None

Excerpt of article text...

You might be wondering why you haven't seen any tips about Xojo's Web Edition in this column. Well, there's a simple reason for it: I have no clue about Web Edition. I only have an old expired license for it, and I don't use it. Yet. So I'm completely dependent on our readers to send in their tips. Michel Bujardet has not only done so for our first tip, but he came up with a whopper: tap into the potential of JavaScript to enhance the power of Xojo's Web edition.

Tip 1: JRSwhere: Get the mouse cursor location in Xojo Web

Unlike Desktop, Xojo Web does not have System.MouseX and System.MouseY to report the location of the mouse cursor. The only available way is to use the MouseMove event. Unfortunately, that event requires a round trip between the server and client for every pixel, which means such a huge amount of traffic it may very well overflow the app. As a result, most developers avoid using that event and have to resort to much less precise techniques, such as using MouseEnter and MouseExit.

Here is a technique that uses JavaScript to record client side (in the browser), the position of the mouse. So, when needed, a simple call to a method reports X and Y.

Everything starts with a custom control, created with the help of the WebSDK. You will find the WebSDK documentation in the same folder as the Xojo IDE, inside the Extra subfolder. The WebSDK is a very powerful set of tools that will let you add features to your web apps "the proper way." Here is how you build a class that will execute JavaScript and report the returned values through an event.

  • Insert a new class into your project (Insert menu). Set its name in the Inspector to JSR (stands for JavaScript Return [value]).

...End of Excerpt. Please purchase the magazine to read the full article.