Hi Rob,
i was on version 2013.1202, just downloading latest, which seems to have moved on, perhaps a bug got fixed?
Anway, here is the relevant code in the button listener and then the alert listener.
function onClear_Button (event)
local phase = event.phase
local target = event.target
local clear_memory = false
if (“began” == phase) then
local alert = native.showAlert( “Clear Memory”, “Are you sure?” ,{ “OK”,“Cancel”}, onComplete )
if alert then
program_counter=0
instruction_register = 0
accumulator = 0
memory_address_register = 0
for i = 0,99 do
memory[i] = 0
end
show_pc()
show_acc()
show_ir()
opcode =""
show_opcode()
show_mar()
show_memory()
clear_io_unit()
show_io_unit()
stage_message = “Clear button pressed”
detail_message = “Program cleared and values reset”
show_messages()
end
end
return true
end
function onComplete(event)
if “clicked” == event.action then
if “1” == event.index then
return true
elseif “2” == event.index then
return false
end
end
end
This is my first app with the sdk and generally it is a pleasant experience. Wish there were a few more UI functions, and clearer file handling. Im spending much of my time recreating menus from atoms and also writing some higher level file operations from lfs.
thanks anyway for all the good work.
Martin