How to find the column and row of a basic tableField

Curry Kenworthy curry at pair.com
Sat Apr 4 15:30:39 EDT 2020


PS - Here are two word problems to view this type of algorithm in a 
bigger context beyond just software UI. Not too scary or difficult; our 
ancestors could solve similar problems, and so can kids in school.

Older problem:

You are in charge of preparing animal enclosures for a market. The 
marketplace has several pens that respectively hold 20, 15, 30, and 25 
goats and will be filled in that order. If 42 goats are expected, how 
many of the pens will be needed?

Newer problem:

Your app has a field with tabWidths of 200, 150, 300, and 250 (or the 
equivalent tabStops). The user's clickH minus left edge of the field and 
margin is 420. Assuming field hScroll is 0 and standard borders, which 
column did the user click?

(Then write an LC function to solve for any clickH and tabStops.)

Great exercise for an intermediate LC student to solve WITHOUT having 
previously seen solution source code! I'm fond of this type of problem.

Best wishes,

Curry Kenworthy

Custom Software Development
"Better Methods, Better Results"
LiveCode Training and Consulting
http://livecodeconsulting.com/




More information about the use-livecode mailing list