Keyboard Bug
Posted on Sat, 2011-11-26 21:07
Well I realy don't know what this message says but...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 2011-11-27 03:05:22.786 Corona Simulator[32653:903] HIToolbox: ignoring exception 'NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds' that raised inside Carbon event dispatch ( 0 CoreFoundation 0x999586ca __raiseError + 410 1 libobjc.A.dylib 0x99afb5a9 objc_exception_throw + 56 2 CoreFoundation 0x999583f8 +[NSException raise:format:arguments:] + 136 3 CoreFoundation 0x9995836a +[NSException raise:format:] + 58 4 Foundation 0x96a92b1e -[NSRLEArray objectAtIndex:effectiveRange:] + 118 5 Foundation 0x96a907ca -[NSConcreteMutableAttributedString replaceCharactersInRange:withString:] + 212 6 AppKit 0x98ae0591 -[NSConcreteTextStorage replaceCharactersInRange:withString:] + 102 7 AppKit 0x98b6f96a -[NSTextView insertText:replacementRange:] + 1701 8 AppKit 0x98b6d217 -[NSTextInputContext handleTSMEvent:] + 2657 9 AppKit 0x98b6c7a5 _NSTSMEventHandler + 209 10 HIToolbox 0x94d73c2f _ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 1567 11 HIToolbox 0x94d72ef6 _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 411 12 HIToolbox 0x94d957f3 SendEventToEventTarget + 52 13 HIToolbox 0x94df79de SendTSMEvent + 82 14 HIToolbox 0x94df735b SendUnicodeTextAEToUnicodeDoc + 700 15 HIToolbox 0x94df6f65 TSMKeyEvent + 998 16 HIToolbox 0x94de7e32 TSMProcessRawKeyEvent + 2515 17 AppKit 0x98b6c084 -[NSTextInputContext handleEvent:] + 1453 18 AppKit 0x98b67ed1 -[NSView interpretKeyEvents:] + 209 19 AppKit 0x98b6b9a1 -[NSTextView keyDown:] + 751 20 AppKit 0x98a9cb28 -[NSWindow sendEvent:] + 5757 21 AppKit 0x989b560b -[NSApplication sendEvent:] + 6431 22 AppKit 0x98949253 -[NSApplication run] + 917 23 AppKit 0x98941289 NSApplicationMain + 574 24 Corona Simulator 0x00002d35 0x0 + 11573 ) 2011-11-27 03:05:22.787 Corona Simulator[32653:903] Exception detected while handling key input. 2011-11-27 03:05:22.787 Corona Simulator[32653:903] *** NSRunStorage, _NSBlockNumberForIndex(): index (4294967295) beyond array bounds (0) |
So I get this message in my terminal when I tryed to write something in the field.
I don't see any problem with keyboard but just in precaution I'm posting this
Ah... my code:
in main:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | -- =============================== SALVANDO LOGIN =============================== -- local function resumeStart() local path = system.pathForFile( "saveData3s.txt", system.DocumentsDirectory ) local file = io.open( path, "r" ) if file then print("Loading our data...") local contents = file:read( "*a" ) -- Loads our data local prevState = explode(", ", contents) _G.login = prevState[1] _G.senha = prevState[2] _G.nomeC = prevState[3] _G.emailC = prevState[4] _G.senhaC = prevState[5] io.close( file ) else _G.login = "email" _G.senha = "senhasenhasenha" _G.nomeC = "nome" _G.emailC = "email" _G.senhaC = "senhasenhasenha" end end -- Separates the variables into a table local function onSystemEvent( event ) if( event.type == "applicationExit" ) then local path = system.pathForFile( "saveData3.txt", system.DocumentsDirectory ) local file = io.open( path, "w+b" ) -- Creates the file where we save our data file:write( _G.login ..", ".. _G.senha .. ", " .. _G.nomeC .. ", " .. _G.emailC .. ", " .. _G.senhaC ) end end -- Saves our data function explode(div,str) if (div=='') then return false end local pos,arr = 0,{} -- for each divider found for st,sp in function() return string.find(str,div,pos,true) end do table.insert(arr,string.sub(str,pos,st-1)) -- Attach chars left of current divider pos = sp + 1 -- Jump past current divider end table.insert(arr,string.sub(str,pos)) -- Attach chars right of last divider return arr end local function loadSave() -- start and resume from previous state, if any resumeStart() Runtime:addEventListener( "system", onSystemEvent ) end -- ========================================= FIM ============================================= -- loadSave() |
in another lua file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | LloginHandler = function(event) if event.phase == "began" then LloginField.text = "" elseif event.phase == "ended" then native.setKeyboardFocus( nil ) elseif event.phase == "submitted" then native.setKeyboardFocus( LpasswordField ) end end LloginField = native.newTextField( _W/2 + 55, 180, 235, 40, LloginHandler ) LloginField.font = native.newFont( nil, 25 ) LloginField.text = _G.login LloginField.inputType = "email" LloginField:setTextColor( 0, 84, 166 ) g:insert( LloginField ) |
Replies
Posted on Sat, 2011-11-26 23:24
#2
Uploading testable code would be very useful.
For saving, switch from to using Ice - it's much better and you can avoid globals ;)
Peach :)
Posted on Sun, 2011-11-27 05:51
#3
Can you point me to this "ice"?
Thanks
Posted on Sun, 2011-11-27 06:04
#4
Hi,
ICE?
Here you go --> http://developer.anscamobile.com/code/ice
PS: Sorry Peach, just trying to help. :)
Cheers!
Posted on Sun, 2011-11-27 06:09
#5
@Rodrigo RSCdev
Thank you Rodrigo RSCdev!
she will not mind... I guess hehehehe
Posted on Sun, 2011-11-27 17:59
#6
Haha, not at all - cheers Rodrigo!
Peach :)


I forgot to say...
and this "saveit.lua"