` Printed Icetips Article

Icetips Article



Par2: Dynamically Select-ing a different field at window open
1999-01-26 -- Dennis Evans
 
>In ThisWindow.Init, priority 9999, I have:

> If ThisWindow.Request = Insertrecord
>   If LOC:pCode
>     CTJ:pCode = LOC:pCode     
>     CTJ:Volume = LOC:Volume 
>     CTJ:Issue = LOC:Issue      
>     CTJ:Date = LOC:Date         
>     Select(?CTJ:Author,1)  <=======
>   End
> Else

>The priming works correctly. However, the Select(?  ) does not.

The FirstField property is set in the init method.

The TakeWindowEvent method then selects the FirstField, on a WindowOpen event.

The TakeWindowEvent method is called after the init method is completed, from the 
TakeEvent method.

Place the select statement in the TakeWindowEvent method Event:Open, after the 
parent call.

[shp] Note: The field priming must remain in the After Opeing Window embed (or towards
the end of ThisWindow.INIT). The Select() must be moved as Dennis points out.

Dennis adds:

You can also change the value of the FirstField property.

In the ThisWindow.Init method, after the template sets the value,
embed this Self.FirstField = ?ControlName.

Then after the parent call to TakeWindowEvent,
OpenWindow, reset the property, if needed.

Self.FirstField = ?NewControl.



Printed May 10, 2024, 4:44 pm
This article has been viewed/printed 35116 times.