Button Input And Program flow

Hi, I wonder if anyone could point me in the right direction as I'm a little confused.

I come from a .NET programming environment where if one wants to get user input it usually comes in the form of an event, say a button click event.

Also, if something needs doing in a loop independently of driving the gui (say a timed data log), it can be done on a separate thread or by using a timer.

So, coming from an event driven environment I am having issues with the Arduino.

I'm in the throws of designing a sketch that controls an environment.

I'd like to have either some hardware buttons or a touch screen to allow the user to alter variables for temperature threshold etc.

Problem 1.
If my main sketch loop is looping, reading the sensors then setting the outputs, do I need to put code in that loop to poll for button inputs in order to determine how to draw the LCD?

Problem 2.
I am currently using a 16x2 Keypad LCD shield. Using this shield I'd like to enable the user to scroll a vertical menu system, select a variable to change then use the left and right buttons to change it. Like this :


Obviously my 2 row LCD can only show 2 rows at a time and so is it good idea to assign each value in the list ablove to an integer value which the sketch can track so that when the user clicks the select button it knows what they want to edit?

Problem(ish) 3.
I'm struggling really with design concepts regarding gui interface design and basic user input standard practice. If anybody knows a good tutorial I could read that would be awesome, till now, I can't find anything that is anywhere near comprehensive regarding this.

I guess I could hack something out but I fear I'd be re-designing the wheel, time to ask the experts I think :wink:

Solution 1) Depending on how good your LCD library is, will determine how much you would have to code. Some LCD libraries allow you to make and map buttons easily, others like the one I have, not so much. I had to actually map out by hand where I want my buttons and map out the "active" location of those buttons. It took a while, but I did notice that I could just copy and paste a few coordinants, so I was not that bad.

Solution 2) Again, it depends on the library. There is a post in Programming Questions about a rather good Menu library, check it out.

Solution 3) When in doubt, forum search, Google or Youtube.