[futurebasic] Re: [FB] Field class again

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : August 1999 : Group Archive : Group : All Groups

From: Joe Lewis Wilkins <PepeToo@...>
Date: Sat, 28 Aug 1999 20:01:55 -0700
Rick Brown wrote:

> The simplest way to get the class of an edit field is to use the
> WINDOW(_efClass) function.  There are two things you should note about
> WINDOW(_efClass):
>
> * It only returns information about the currently-active edit field in the
> current output window.  The "currently-active" field is essentially the one
> that's currently receiving keypresses.  If none of the fields in the current
> output window is currently active, then the value returned by WINDOW(_efClass)
> is undefined.
>
> * The number that it returns is actually the same number that you assigned as
> "justify + class" in the EDIT FIELD statement.  This is somewhat confusing in
> the manual.  You have to "tease out" the class number from the value returned
> by WINDOW(_efClass).
>
> For example, if you create the edit field like this:
>
> EDIT FIELD #5, "Hello", (10,50)-(100,66), _framedNoCR, _leftJust + myClass*4
>
> Then the number you will get back from WINDOW(_efClass) is this:
>
> _leftJust + myClass*4
>
> To get back the original value of "myClass", use this:
>
> WINDOW(_efClass) / 4

Rick, my first reaction was that you are completely correct; but, on examination,
the "teasing" doesn't prove out - unless I've missunderstood something. Since I
just had a nap, I don't think so. Let's assume in the EF declaration above that
myClass = 200 and we do exactly what you've noted. Doing that results in this:
(I've just converted myClass to a string so it could be displayed in an EF.)

class$ = STR$(WINDOW(_efClass)/4), from which class$ = "8" which is not 200;

whereas if we do:

EDIT FIELD #5, "Hello", (10,50)-(100,66), _framedNoCR, _leftJust + myClass
'Note: not *4
class$ = STR$((WINDOW(_efClass))-_leftJust)          'Of course _leftJust could
be a variable too

from which class$ has a value of "200"      'The only limitation being that
myClass must be > 3

Have I missed something?

Joe Wilkins