Color Conundrum (was "Change Colors") 
Author Message
 Color Conundrum (was "Change Colors")
Why the heck doesn't this work:

This code is in the arrive method of the form
in which the field "NextCall" resides.  All the dates come out red,
even those later than today!

method arrive(var eventInfo MoveEvent)
        var
        endvar

if nextcall.value <= today()
then nextcall.font.color = red
else nextcall.font.color = black
endif

endmethod

Ken



Mon, 02 Jul 2001 03:00:00 GMT
 Color Conundrum (was "Change Colors")

: This code is in the arrive method of the form
: in which the field "NextCall" resides.  All the dates come out red,
: even those later than today!

: if nextcall.value <= today()
: then nextcall.font.color = red
: else nextcall.font.color = black
: endif

My guess is that the arrive method for the form is called before
any values are assigned to the field.  You'll have to try putting
your code somewhere else.  Possibly you could use the newValue
event, in combination with an if...then statement that tests the
eventInfo.reason().  (NewValue events are fired often, and you
don't want the code firing every single time.)
--
============================================================

============================================================



Mon, 02 Jul 2001 03:00:00 GMT
 Color Conundrum (was "Change Colors")
Instead the  newValue  might serve you better. HTH

;// NextCall field
method newValue(var eventInfo Event)

if self.value <= Today() then
 self.font.color = Red
else
 self.font.color = Black
endIf

endMethod

Quote:

> Why the heck doesn't this work:

> This code is in the arrive method of the form
> in which the field "NextCall" resides.  All the dates come out red,
> even those later than today!

> method arrive(var eventInfo MoveEvent)
>         var
>         endvar

> if nextcall.value <= today()
> then nextcall.font.color = red
> else nextcall.font.color = black
> endif

> endmethod

> Ken

--
Michael


Mon, 02 Jul 2001 03:00:00 GMT
 Color Conundrum (was "Change Colors")

Quote:


>: This code is in the arrive method of the form
>: in which the field "NextCall" resides.  All the dates come out red,
>: even those later than today!

>: if nextcall.value <= today()
>: then nextcall.font.color = red
>: else nextcall.font.color = black
>: endif

>My guess is that the arrive method for the form is called before
>any values are assigned to the field.  You'll have to try putting
>your code somewhere else.  Possibly you could use the newValue
>event, in combination with an if...then statement that tests the
>eventInfo.reason().  (NewValue events are fired often, and you
>don't want the code firing every single time.)
>--

Nope, when the user arrives at the form I want to notify them if this
client is overdue a call.  The data was entered prior to their
arriving.

- Show quoted text -

Quote:
>============================================================

>============================================================



Mon, 02 Jul 2001 03:00:00 GMT
 Color Conundrum (was "Change Colors")
You could use a combination of the  newValue  and  action  methods. You
might find that notification is too eager. HTH

With a Multi Record Object

;Record
method action(var eventInfo ActionEvent)

if eventInfo.id() = DataArriveRecord then
 if NextCall.font.color = Red then
  msgInfo("Status","Overdue")
   endIf
endIf

endMethod

and

;// NextCall field
method newValue(var eventInfo Event)

if self.value <= Today() then
 self.font.color = Red
else
 self.font.color = Black
endIf

endMethod

Quote:



> >: This code is in the arrive method of the form
> >: in which the field "NextCall" resides.  All the dates come out red,
> >: even those later than today!

> >: if nextcall.value <= today()
> >: then nextcall.font.color = red
> >: else nextcall.font.color = black
> >: endif

> >My guess is that the arrive method for the form is called before
> >any values are assigned to the field.  You'll have to try putting
> >your code somewhere else.  Possibly you could use the newValue
> >event, in combination with an if...then statement that tests the
> >eventInfo.reason().  (NewValue events are fired often, and you
> >don't want the code firing every single time.)
> >--
> Nope, when the user arrives at the form I want to notify them if this
> client is overdue a call.  The data was entered prior to their
> arriving.

> >============================================================

> >============================================================

--
Michael


Mon, 02 Jul 2001 03:00:00 GMT
 Color Conundrum (was "Change Colors")
Ken:

One of the things that I always <g> forget is to "doDefault" prior to
the time that other things are to happen - especially with the arrive
method.

Bob



Mon, 02 Jul 2001 03:00:00 GMT
 Color Conundrum (was "Change Colors")

Quote:

>> Why the heck doesn't this work:

>> This code is in the arrive method of the form
>> in which the field "NextCall" resides.  All the dates come out red,
>> even those later than today!

>> method arrive(var eventInfo MoveEvent)
>>         var
>>         endvar

>> if nextcall.value <= today()
>> then nextcall.font.color = red
>> else nextcall.font.color = black
>> endif

>> endmethod

>> Ken
>Instead the  newValue  might serve you better. HTH

>;// NextCall field
>method newValue(var eventInfo Event)

>if self.value <= Today() then
> self.font.color = Red
>else
> self.font.color = Black
>endIf

>endMethod

Now, that worked!  Thanks.  I had tried the ChangeValue method, but
that didn't work.  I created a custom method called NewValue to run
your code.  I'm curious, why wouldn't the arrive method work?

Kent



Mon, 02 Jul 2001 03:00:00 GMT
 Color Conundrum (was "Change Colors")

Quote:

>Ken:

>One of the things that I always <g> forget is to "doDefault" prior to
>the time that other things are to happen - especially with the arrive
>method.

>Bob

doDefault didn't seem to help my arrive method, but it is certainly a
concept to ponder... (aw, my aching head!)

Ken



Tue, 03 Jul 2001 03:00:00 GMT
 Color Conundrum (was "Change Colors")
Try using the eventinfo.newvalue method from within the change value method.
there is more detail on this in the on-line help under newvalue


Tue, 03 Jul 2001 03:00:00 GMT
 
 [ 9 post ] 

 Relevant Pages 

1. Color code question(msie5"silver")

2. "Help" Fox2.6 Default Colors

3. Change the edit Field background color in alternating portal colors

4. Changing Text color and field color.

5. Recordset.Properties("Maximum Open Rows") conundrum

6. ??desktop color/application color??

7. how to set color to a customized color

8. Colors--How do I get more colors?

9. Getting the color white on toolbar buttons in 256 color mode

10. PRINTING Color Coded Syntax IN COLOR?

11. max of ("...","...","..")

12. Changing Font Color Also Changes Font?


 
Powered by phpBB® Forum Software