Search the web
Sign In
New User? Sign Up
Rebol_New · For beginning Rebol programmers
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Calculating size (number of chars. in the string) of data in a 'fie   Message List  
Reply | Forward Message #231 of 315 |
Re: Calculating size (number of chars. in the string) of data in a 'field'

On 21-Aug-02, johnfdutcher wrote:

> The 'key-event:'function below nicely allows me to 'filter' the
> keystrokes into my GUI. So far, no code experiment at the line whose
> content (near the end) is:
>
>> length? to-string face/data [inform dialog2]

> successfully allows me to know the number of characters in the
> 'face' (a text field) currently entered. Either nothing happens,
> (the referenced dialog doesn't open) or there will be a compile time
> error.

Hi John,

Part of your problem is the face in your function is the window-level
face, not the field face. Place this line before the above...

print ["Face/text..." face/data face/text]

and you'll see that both data and text remain none regardless of how
many numbers you enter in the fields. As it is, you'd have to check
each field individually to restrict their text lengths. The
following in place of your above line would do this for the num1
field...

if all [num1/data 2 = length? num1/data][inform dialog2]

though only the num1 field. ('all is used so it won't trip up when
data is none. 'all stops looking at the expressions in its block if
false (or none) is returned by any of them, so when num1/data is
none it'll exit before it gets to the expression checking the
length, thus avoiding an error.)

So, you'd need a check like the above for each of your fields, which
would work I guess, but isn't very elegant. Ideally, you should be
altering the fields' feel instead of the global events, but off the
top of my head I'm not sure how to do that. Hope this helps, anyway.

--
Carl Read




Wed Aug 21, 2002 8:42 am

lunaread
Offline Offline
Send Email Send Email

Forward
Message #231 of 315 |
Expand Messages Author Sort by Date

The 'key-event:'function below nicely allows me to 'filter' the keystrokes into my GUI. So far, no code experiment at the line whose content (near the end) is:...
johnfdutcher
Offline Send Email
Aug 20, 2002
5:53 pm

... Hi John, Part of your problem is the face in your function is the window-level face, not the field face. Place this line before the above... print...
Carl Read
lunaread
Offline Send Email
Aug 21, 2002
11:13 am

Carl, You instigated a major step forward...as the suggested line does indeed put up the dialog when a 3rd keystroke is made. Can you comment on this...
johnfdutcher
Offline Send Email
Aug 21, 2002
12:22 pm

... Groan - yes, you're right. I hadn't tested the other fields. Anyway, have a look at the attached script. (Line-wraps can muck up scripts in the body of...
Carl Read
lunaread
Offline Send Email
Aug 21, 2002
11:32 pm

What a really effective piece of work ... and just what I'm looking to find ! Thanks much Carl. I keep hoping Rebol will 'make it'....but suppose time will...
johnfdutcher
Offline Send Email
Aug 22, 2002
12:35 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help