New topic: 

Limiting text entry in Listbox

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

         Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic          Author  
Message        markwalsh          Post subject: Limiting text entry in 
ListboxPosted: Wed Apr 27, 2011 9:05 am                         
Joined: Wed May 20, 2009 4:43 pm
Posts: 463                I need to be able to limit the text entry in a 
listbox cell (length, restrict certain characters), and I have a few questions 
regarding the best ways to accomplish this.

I am filtering out the restricted characters in the CellKeyDown event, but that 
doesn't prevent the user from pasting in a string containing these characters. 
Is there a way to strip out the restricted characters when pasting into the 
cell? Do I need to filter the pasted text in the 'CellTextChange' event (I'm 
guessing that I'll have to set a flag to prevent the event from running a 
second time if I change the string during that event, as well as the keep track 
of the current selection settings); will this cause any problems, or is there a 
better way?

I have found that I can get the Listbox.activeCell property, and set it's 
properties such as the 'mask' property to limit the text entry, but other 
properties are not available such as the 'limitText' property. I have found 
that I can get around this by casting the ActiveCell into the proper type like 
this:
Code:  If me.ActiveCell IsA TextField then
  TextField(me.ActiveCell).LimitText = 5
  elseif me.ActiveCell IsA TextArea then
  TextArea(me.ActiveCell).LimitText = 5
  end if
  
And that works, but is the fact that the LimitText property is not directly 
available a bug?      
_________________
RB 2009r4 Windows XP  
                             Top            Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]      
-- 
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