New topic: 

TextField "KeyDown" versus "LostFocus"

<http://forums.realsoftware.com/viewtopic.php?t=43965>

         Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic          Author  
Message        RonBower          Post subject: TextField "KeyDown" versus 
"LostFocus"Posted: Fri May 11, 2012 12:03 pm                         
Joined: Wed Feb 01, 2012 3:06 pm
Posts: 24                My application has a window with about a dozen 
different text fields where the user enters various types of information that 
is eventually entered into a database.

As currently coded, the data entered into each field is processed/examined each 
time the user enters either a "Tab" or an "Enter" Key with code in each 
TextField's "KeyDown" event handler.  The application is working well and has 
been tested by a half dozen beta testers.

One new user is moving from field to field by clicking the mouse into each 
field - thus he progresses through the form without ever hitting a "Tab" or an 
"Enter".  To accomodate this user's habits, it seems that I have to replicate 
the code in each control's "KeyDown" event handler into each control's 
"LostFocus" event handler and treat it as a "Tab".

It just seems that there has to be a better way - maybe I started with the 
wrong approach long ago.

Any advice for this newbie ???

Ron Bower
Ellicott City, MD   
                             Top                elChupete          Post 
subject: Re: TextField "KeyDown" versus "LostFocus"Posted: Fri May 11, 2012 
12:56 pm                                 
Joined: Fri Jun 05, 2009 11:50 am
Posts: 307
Location: Hamburg, Germany                Lostfocus seems to be the only place 
to execute the check.

If you want to check in keydown and lostfocus using the same checkrules simply 
put the check rule into an own method and call it from keydown and lostfocus. 
So you end up with just one place where the check is coded      
_________________
Best regards

Stefan

Mac OSX 10.7.3 on a MacBook Pro 2.66 GHz Intel Core i7/ RB Professional 2011 
Release 3  
                             Top                DaveS          Post subject: 
Re: TextField "KeyDown" versus "LostFocus"Posted: Fri May 11, 2012 1:43 pm      
                           
Joined: Sun Aug 05, 2007 10:46 am
Posts: 3672
Location: San Diego, CA                FUNCTION KEYDOWN(key as string) as 
boolean
  if ascb(key)=13 or ascb(key)=3 then VALIDATE_MY_INPUT
END FUNCTION


SUB LOSTFOCUS
  VALIDATE_MY_INPUT
END SUB


move all validation code to VALIDATE_MY_INPUT      
_________________
Dave Sisemore
MacPro, OSX 10.7.3 RB2011r3
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             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]

Reply via email to