Tips and Tricks for the Xojo Developer
Issue: 12.2 (March/April 2014)
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): 9,150
Starting Page Number: 72
Article Number: 12214
Related Link(s): None
Excerpt of article text...
This time we will get more into the meat and bones of coding by looking at tips which try to further the understanding of beginners.
We all approach programming with preconceptions which are often shaped by our experiences—we count from 1 to 10, we learn the alphabet from a to z. And sometimes these preconceptions can stand in the way of solving programming problems. This was again brought home to me by a question (https://forum.xojo.com/8884-delete-only-selected-rows/0#p62745) that quite regularly pops up in various guises on the forum and mailing list. Basically it is a variation of: "I try to delete selected rows from a ListBox but get an OutOfBoundsException" or "I delete entries from an array but it isn't working as I want it to". And the solution invariably comes down to the simple fact that instead of counting
up- you have to count down. So instead of starting at the first row and counting to the last:
for i as integer = 0 to listbox1.listcount - 1
if listbox1.selected(i) then
...End of Excerpt. Please purchase the magazine to read the full article.