Skip to content

Category: Tips

sort code tips and tricks

PDF Arrives at Xojo!

Xojo 2020r1 brings a highly requested feature to the Xojo IDE: the ability to create PDF documents from code! Now you can use the already familiar methods in Xojo’s Graphics class to create Standard PDF 1.4 documents with the PDFDocument class.

Comments closed

Top-Rounded Rectangle

On the forum a user asked if there was a way to create a rectangle with only the top left and top right corners being rounded. Xojo’s built-in RoundRectangle control draws with all four corners rounded, so that was not an option.

One solution is to use a GraphicsPath to draw exactly what you want. With a GraphicsPath you can use the AddArc() method to add rounded corners and then draw the lines for the rest of the rectangle.

Comments closed

Code Tip: How to Implement the ARC4 Encryption Algorithm

ARC4 is a symmetric encryption algorithm fast and easy to implement. Being symmetric does means that it uses the same function with the same key (varying from 40 to 2048 bits) both for cyphering and de-cyphering a block of data.

Is it the most secure or robust encryption algorithm around? Not really. But it provides a good amount of performance and you can take further steps in order to correct some of its flaws. So, continue reading if you are interested in having this one in your developer toolset implemented as a Class with separate methods to encrypt and decrypt a block of information (even if it uses the same function in both cases).

Comments closed

Quick Tip: Centering a Picture on any Graphic Context

Sure you can create a Subclass of any Picture, Canvas or class and write code to center another Picture in its respective Graphics contexts. But taking the class extension approach means that you can reuse the same code for any of these (or any additional class) offering a Graphic context, so you can pass along the Picture you want to center and re-scale (if needed) in its area.

Comments closed

Tip: LinkLabel on Desktop

The Xojo Web Framework offers the WebLink class ready to use which handles showing the text with the proper visuals and the opening of the underlying URL in the browser. But if you need to have that feature on Desktop, it’s not that hard! Continue reading so I can show you one possible implementations to create your own LinkLabel class on Desktop.

Comments closed

Using Class Extensions to Validate Email and URL Data

Often in our projects we need to apply some kind of validation of the user input so we get the data we are expecting. For example, getting a valid email addresses or URL. I want to share with you a couple of String Class extensions you can use to see (and conform) whether the user typed a valid email or URL, this is not a silver bullet (there are always exceptions), but it can save you some time now and in future projects.

Comments closed

Tip: Country Selector for Web Apps

All of us are used to dealing with that web form where we select a country from a long, long list of more than 200 hundred countries. It would certainly be more useful, less stressful and a better usability practice to preselect the country name from the IP of the client visitor. Continue reading to learn how you can put a bit of intelligence into your web forms using a WebPopupMenu subclass.

Comments closed