Using canArrive at the form level.

Using canArrive at the form level.

Post by Wayne Barret » Fri, 27 Mar 1998 04:00:00



I have a form with 45 date fields on it. Each field has certain criteria
that must be met before a date may be entered in the field. I'm using
the field's label text color to determine if the field is available. If
the font color is gray, the canArrive method on the field is disabled,
if black its enabled. I would like to use the canArrive method at the
form level and test the active field object for it's text object font
color, instead of writing essentially the same code 45 times-once for
each field's canArrive method. Anyone out there have any suggestions on
how to do this?

 
 
 

Using canArrive at the form level.

Post by Mick » Sat, 28 Mar 1998 04:00:00


method canArrive( var eventInfo moveEvent ??)
var
  ui  UIObject
endVar
if isPrefilter then
        eventInfo.GetTarget( ui )
        if ui.type = Field then
          if ui.color = gray then
                eventInfo.SetErrorCode( peCannotArrive )
          else
                eventInfo.SetErrorCode( peCanArrive )
          endIf

        endIf
else

endIf

Something like this, I'm not sure that I have the syntax correct.
mick

 
 
 

Using canArrive at the form level.

Post by Michael Juul Hanse » Sat, 28 Mar 1998 04:00:00


I was about to suggest the same solution but:

With this code how does the user move to the next field with a non-gray
font color?
Pressing tab and the next field in TabOrder has a Gray font color means
that the move is suspended

Mickl skrev:

Quote:> method canArrive( var eventInfo moveEvent ??)
> var
>   ui  UIObject
> endVar
> if isPrefilter then
>         eventInfo.GetTarget( ui )
> ;        if ui.type = Field then

        if ui.type = "Field" then

Quote:>           if ui.color = gray then
> ;                eventInfo.SetErrorCode( peCannotArrive )

                eventInfo.SetErrorCode( CannotArrive )

Quote:>           else
> ;                eventInfo.SetErrorCode( peCanArrive )

                eventInfo.SetErrorCode( Can_Arrive )

Quote:>           endIf

>         endIf
> else

> endIf

> Something like this, I'm not sure that I have the syntax correct.
> mick

--
Michael

Remove 'NOSPAM' before e-mail

 
 
 

Using canArrive at the form level.

Post by So'n'S » Sat, 28 Mar 1998 04:00:00


That's right.  Wouldn't it be better to do the work in the depart() method.
 Suspend the default and could test each field's value/color (in a for
loop) and when you got a good value, you would MoveTo() that field.



Quote:> I was about to suggest the same solution but:

> With this code how does the user move to the next field with a non-gray
> font color?
> Pressing tab and the next field in TabOrder has a Gray font color means
> that the move is suspended

 
 
 

Using canArrive at the form level.

Post by Vladimir Menki » Sat, 28 Mar 1998 04:00:00


Hi!

Instead of using canArrive you can drop TABSTOP property
of a field to false at the same time, when you change
font color to gray.

 Vladimir Menkin


> I have a form with 45 date fields on it. Each field has certain criteria
> that must be met before a date may be entered in the field. I'm using
> the field's label text color to determine if the field is available. If
> the font color is gray, the canArrive method on the field is disabled,
> if black its enabled. I would like to use the canArrive method at the
> form level and test the active field object for it's text object font
> color, instead of writing essentially the same code 45 times-once for
> each field's canArrive method. Anyone out there have any suggestions on
> how to do this?

 
 
 

Using canArrive at the form level.

Post by Alistair Wal » Sun, 29 Mar 1998 04:00:00




Quote:>I have a form with 45 date fields on it. Each field has certain criteria
>that must be met before a date may be entered in the field. I'm using
>the field's label text color to determine if the field is available. If
>the font color is gray, the canArrive method on the field is disabled,
>if black its enabled. I would like to use the canArrive method at the
>form level and test the active field object for it's text object font
>color, instead of writing essentially the same code 45 times-once for
>each field's canArrive method. Anyone out there have any suggestions on
>how to do this?

Declare a UIObject variable uiTarget, use GetTarget(uiTarget) to
identify which object you are arriving on, and test uiTarget.class
and/or uiTarget.name to see if it is one of your 45 fields.

However, there are some disadvantages to putting code in form methods.
It makes forms sluggish, because it is executed whenever anything
happens on the form. It makes your program harder to understand, because
the behaviour of your fields is governed by code which is not attached
to the fields. The code you write in the form will be less efficient
than code you write for fields, because it will have to test whether the
object of the code is in fact a field.

The best solution is to write the code for one field, using 'self'
wherever the procedure refers to the field, and call this method in the
other fields' canArrive methods.
--
Alistair Wall

 
 
 

Using canArrive at the form level.

Post by Alistair Wal » Sun, 29 Mar 1998 04:00:00




>That's right.  Wouldn't it be better to do the work in the depart() method.
> Suspend the default and could test each field's value/color (in a for
>loop) and when you got a good value, you would MoveTo() that field.



>> I was about to suggest the same solution but:

>> With this code how does the user move to the next field with a non-gray
>> font color?
>> Pressing tab and the next field in TabOrder has a Gray font color means
>> that the move is suspended

Alternatively, set the field's TabStop property to false at the same
time as you set the label colour to grey.
--
Alistair Wall
 
 
 

1. addressing form from menu on top level form ?

I have screen = off .. and am using a top level form with a menu
on it ..

the top level form is called   ... mainform

from the menu on the form .. I menu .." import old records "

( if it was from a button on the form .. there would be no
  problem .. but because im trying to do it from the menu
  is where im having all the difficulty )

I want to pop us a msg on the form saying .. something
like ...  "  Importing Records ... "

so I have this msg on the form that I have starting out as
invisible ..

what I want to do is .. make the msg visible for a few seconds
displaying this msg

************
a wait window .. didnt work at all
************
from a procedure in the menu .. I said .. thisform.msgtxt.visible = .t.
( this error'd saying "THIS" is only allow in a method )
***********
I tried  ..  mainform.msgtxt.visible = .t.
( this didnt error .. but .. neither did the msg appear either .. <g> )
**********

I have tried putting the code in a procedure in the menu
I tried calling an external prg .. from the menu ..

I would put it in a custom method .. but .. im not sure how to call
that method from within my menu ..

any ideas ..

Mike

2. Send email to operator when profile closed

3. release form - from menubar of top level form ?

4. More Current Alternative to MTS

5. Page level, table level locks used.

6. onstat -D vs onstat -g iof

7. Level-1 backup after level-0 using ontape

8. bad log record

9. canArrive and MsgInfo

10. canArrive

11. Problem with canArrive method in Paradox 7.0

12. canDepart/canArrive problem

13. canArrive/ChangeValue Hiarchy