Xojo Developers: Top Contributor

I was rather pleased when I saw this when logging into the Xojo Developers Group Forum recently 🙂

www.stevencholerton.com

blog_footer.png

Products
Affiliate Links

Listbox Exporting: Take 2

Following on from a previous post last week where I talked about exporting data from a Listbox in Xojo / REALStudio, I decided to build a general purpose export routine with the extra features that were commented on and also some extra features that I believe make this routine even more useful.

Note: This is not the only way of programming a generic export function and no doubt it is not the best. It does however work and work well.

This export routine is a single simple function and is accessed by sending a string of parameters and having the results of the export request returned as an Integer containing different values depending on the success or what kind of failure occurred.

The parameters that are required by the function are:

  1. Delimiter (Comma, Tab (chr(9)), Full Stop etc.)
  2. Headings (YES or NO)
  3. Name of the Source Listbox
  4. Filename Extension (Tab, Csv etc.)
  5. Default Filename (Export.txt)
  6. Surround with Quotes (YES or NO)

A call to this export routine would therefore look something like this:

www.stevencholerton.com

For ease of reading and maintainability this is better:

www.stevencholerton.com

The actual export function itself looks like this:

www.stevencholerton.com

Note: There is a small error in the picture of the export function above. This error has been fixed in the Text download. Thanks to Axel Schneider on the Xojo Forums for pointing this out. 

To download the export function as text, please click here

blog_footer.png

Products
Affiliate Links

Get Involved ?

I’m looking for Testers and Reviewers for my products. If you are interested in being involved then you can apply here:

Testers

Reviewers

warm-fuzzy-4.jpg?w=450

Although there is no financial incentive there is the opportunity to get involved in the thrilling Software Development process (!) and then of course there is that warm fuzzy feeling that you get from helping someone out – a feeling that is way more inviting and satisfying  than any form of payment …

blog_footer.png

Products
Affiliate Links

Xojo / RS Export Listbox

I’m going to start adding some software development tips and tricks and other useful bits and bobs to this site with the hope that other people can learn and benefit from my knowledge and experience in the same way that I have learnt, and continue to learn, from others.

I’m not sure yet if there will be a particular focus or even how often I’ll post – but that will become apparent over time.

I’ll start with this; a simple method, written in Xojo / REALStudio, to take the contents of a Listbox and generate a Tab Delimited export to a text file for every row and every column in the Listbox. In this example the Listbox is named lstTemp and you will have previously populated it with your data.

  ‘Export the List as Tab Delimited
  if lstTemp.ListCount = 0 then Return
  dim f as FolderItem
  dim t as TextOutputStream
  dim intRow, intColumn as Integer = 0
  f = GetSaveFolderItem(“txt”,”Export.txt”)
  if f = Nil then Return
  t = f.CreateTextFile
  for intRow = 0 to lstTemp.ListCount-1
    for intColumn = 0 to lstTemp.ColumnCount-1
      t.Write ConvertEncoding(lstTemp.Cell(intRow,intColumn),Encodings.SystemDefault)
      t.Write chr(9)
    next
    t.Write EndOfLine
  next
  t.Close

Originally when I published this on a previous blog, I had some feedback from a friend of mine and fellow Developer, Eric Gibbon of MacTasks. This is what he had to say:

The code is quicker if you store the lstTemp.ListCount-1 and lastTemp.ColumnCount-1 in local variables, as for every loop iteration your code calls the ListBox to get its ListCount or ColumnCount value and then subtracts one. However if these values are stored in local variables this repeating does not happen. For a small list this will not matter but for larger ones there will be a performance difference. So the code would be like:

dim nRows as Integer = lstTemp.ListCount – 1
dim nCols as Integer = lstTemp.ColumnCount – 1
for intRow = 0 to nRows
  for intColumn = 0 to nCols
  next
  …
next

 

It would also be nice to add a parameter to your routine for “Include Headings” and write the ListBox headings to the file first if this parameter is True.

I hope this helps someone.

Blatant Advertising: New Xojo / REALStudio DataViewer Component

blog_footer.png

Products
Affiliate Links

Too Expensive ?

As a person who creates software products and solutions for a living I am always looking for the tool that will make me faster, more efficient, better, more productive or just something different for a change. A challenge is as good as a rest 🙂

I came across this product yesterday, which pretty much does what my existing development software does – however after my clicks, deep within the site I came across the price …

stevencholerton.com

Image used without permission. Please don’t tell …

For nearly £4000 I have no idea who on earth would use this product. Not the Independent Software Developer that’s for sure. That only leaves the large consultancy companies and the corporates with in-house development teams.  Is that really a big enough market to sustain a product costing that much ?

Obviously I support the right for anyone to charge whatever they want for any product or service. That’s fundamental to Capitalism and the way the Western World works.  A few years ago I was the guy billing £100 per hour and supplying the information to the ‘Forensic Accountant’ who was tidying it up, putting his name at the top of the page and billing £350 per hour … and that’s fine, I was happy with my fee and I’m sure he was happy with his 🙂

Still, I am astounded by the price of this development product – but good luck to them.  I would be interested to know how many units they are shipping though …

blog_footer.png

Products
Affiliate Links

DataViewer [Update] 2301

This latest update to the DataViewer components for Xojo and REALStudio contain the following enhancements, in addition to a few bug fixes:

The size and position of the windows are saved and recalled next time the windows are opened. In addition the Results List and History List visual configurations are saved and also automatically recalled next time.  This includes the Font and Font Size, the Line Type (None, Dotted or Full) and the Background Colour of the Alternating Rows (if used).

Also new is the SQL History List. Every statement and the results are recorded in this list for the duration of the session. To execute a particular statement again, double click the appropriate History List row.

History is not saved between sessions, although this would be trivial to do. If there is any demand for this feature I will add it in a future update.

I hope these enhancements are in keeping with the direction you’d like to see these components evolve. Please get in touch with your feedback and requests.

steve@zombielabs.net

DataViewer

DataViewer

blog_footer.png

Products
Affiliate Links