keroppe.blogg.se

Xojo 2015r2
Xojo 2015r2











xojo 2015r2
  1. #Xojo 2015r2 how to#
  2. #Xojo 2015r2 software#
  3. #Xojo 2015r2 code#

  • HTTPSocket (which supports HTTP 1.1 – yes, you’ve been asking for that for years).
  • #Xojo 2015r2 code#

    We’ve added a lot more functionality to the new framework in 2015r2 allowing you to write most of your non-GUI code using the new framework and share that across all project types. They don’t require more code than using IF statements and in many cases, require less code and make your code easier to read. In the new Xojo framework we are making it easy for you to do this by consistently using exceptions to report errors.

    #Xojo 2015r2 software#

    Write your code so that it anticipates errors properly and handles them rather than waiting for the user to report that your software doesn’t work. When it comes to errors, luck favors the prepared. Exceptions also potentially remove lots of IF statements that often litter code checking for error conditions. And of course you could choose to make the error message more specific, telling the user what row the bad data came from and showing them the bad data itself so they can go fix the data file.

    xojo 2015r2

    In the new Xojo framework, all the functions that deal with opening and reading files throw the same BadDataException if something goes wrong, a single Try…Catch can handle it all. In this example I’ve left out the code you’d write to open the file, read in the data and do something with it, but you get the idea. MsgBox "The import can't continue because the sales data is bad." 'code to deal with the converted value here I = Integer.FromText(ImportedQuarterlySalesData) 'code to open the file and read the data here If an exception occurs, the code will call the exception handler (the catch portion of the Try…Catch statement) and deal with the error. To use an exception you wrap the block of code that might result in an error in a Try…Catch statement. An exception means that something unusual has happened and in most cases the app (or at least the function of the app the user is using) can’t continue. If you haven’t used exception handling in your code before, don’t panic. In the Xojo framework, you don’t worry about it and check for an exception. If they aren’t, then there was a non-numeric character in there. In the Classic framework, detecting an error like this means converting the text to an integer then back to text and to compare it with the original value to see if they are the same. While the Classic framework has many different ways to handle errors, the new Xojo framework uses exceptions exclusively for reporting errors, making it more consistent. If QuarterlySalesImportedValue cannot be converted to a number (because it starts with a non-numeric character like a $), rather than return a zero, a BadDataException exception is thrown. Your code looks like this: Sales = Integer.FromText(QuarterlySalesImportedValue) Instead of using Val to convert text to a number (integer), you use the FromText function. If zero is a potentially legitimate value, this error could easily be over-looked. This results in a zero when passed to Val. One of the thousands of values you import has a dollar sign at the front.

    xojo 2015r2

    For example, say you are importing sales data from a text file. Second, they are behaviors rather than actual errors and third (and most important), they allow code to pass along a value that could be legitimate without the user knowing it’s an error at all. First, they are all different so you have to learn different ways to handle different errors. There are three problems with handling errors in this way. These may seem like reasonable results to return given what was passed in. Use the Left function to get the 5 leftmost characters from a string that has only 4 characters, and it will return those 4 characters. Pass Val the string “123$” and you’ll get 123 but pass it “$123” and you’ll get 0. For example, if you passed a string to the Val function, it would return zero if the function started with a non-numeric character. Previously, there were different ways to deal with errors depending on what part of the Classic framework you were using. With today’s release of Xojo 2015r2, we have added a lot more functions to the Xojo framework, all of which are now supported for the desktop and web in addition to iOS.

    xojo 2015r2

    The Xojo framework was introduced four months ago with our support for iOS and at that time was limited to iOS projects only. We refer to the current framework as the “Classic” framework and the new one as the “Xojo” framework.

    #Xojo 2015r2 how to#

    One of the things we have learned is how to deal with errors.Ĭh-ch-ch-changes (turn and face the strain) – David BowieĪs you have read in previous blog posts, we are building a new framework to clean things up. Xojo has been around for a long time now and in all that time we have learned a thing or two. In the real world, we learn more each day and what seemed right yesterday, a month ago or a few years ago, may no longer be right today. In the ideal world when you do something, you do it right the first time.













    Xojo 2015r2