New topic: Backwards Textfield with replaceall?
<http://forums.realsoftware.com/viewtopic.php?t=41169> Page 1 of 1 [ 3 posts ] Previous topic | Next topic Author Message simonjohn Post subject: Backwards Textfield with replaceall?Posted: Wed Oct 26, 2011 9:39 am Joined: Sat Apr 19, 2008 12:44 pm Posts: 427 Location: Dorset, UK I have some textfields where I want spaces replaced with underscores as the user types into the textfield, I have been developing an applilcation under Cocoa, but due to the frustrations with textareas not formatting correctly and listbox scrolling going bonkers I thought I'd go back to Carbon. Anyway I have this code in the TextChange event of a Textfield: Code:me.text = replaceall(me.text, " " , "_" )This was working fine in the Cocoa build - BUT under Carbon it 'backwardises' my text! Typing in 'the quick brown fox' results in: Cocoa - the_quick_brown_fox Carbon - xof_nworb_kciuq_eht Is it me? Am I going mad (probably)? I'm almost sure I've done this sort of thing before!!! The insertion point seems to be returning to the start of the field after the 'replace' -on every character. Maybe this is what it's supposed to do? I can get round the problem by using me.SelStart=len ( me.text ) after the replace, but it just seems weird! ( Mac OS X 10.6.8 , RS 2011 R3 ) _________________ Simon Larkin QiSQL Database Solutions SQL Tutorial : http://qisql.com/qisql_sqlite_lessons.html I'm going to Frankfurt in November, see you there? http://www.monkeybreadsoftware.de/realbasic/events/frankfurt-2011-event.shtml Top DaveS Post subject: Re: Backwards Textfield with replaceall?Posted: Wed Oct 26, 2011 9:57 am Joined: Sun Aug 05, 2007 10:46 am Posts: 3266 Location: San Diego, CA Why not subclass the Textfield and in the KEYDOWN event change <SPACE> to <underscore> that way they can't even enter a space to begin with _________________ Dave Sisemore MacPro, OSX 10.6.8 RB2011r3 Note : I am not interested in any solutions that involve custom Plug-ins of any kind Top simonjohn Post subject: Re: Backwards Textfield with replaceall?Posted: Wed Oct 26, 2011 12:12 pm Joined: Sat Apr 19, 2008 12:44 pm Posts: 427 Location: Dorset, UK Thanks Dave. It's already a sub classed Textfield with some 'banned' keys on the key down, for soem reason I did the replacing in Textchanges - I must be getting old. _________________ Simon Larkin QiSQL Database Solutions SQL Tutorial : http://qisql.com/qisql_sqlite_lessons.html I'm going to Frankfurt in November, see you there? http://www.monkeybreadsoftware.de/realbasic/events/frankfurt-2011-event.shtml Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 3 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
