On 5/23/02 9:20 AM, "Robert Purves" <robert.purves@...> wrote: > > On Thursday, May 23, 2002, at 11:24 PM, Douglas Stemen wrote: > >> The following example code demonstrates the bug with static edit fields >> that >> I am experiencing in my accounting program. >> >> In this example, a regular edit field can be made static and then >> return to >> non-static. >> >> A static edit field cannot be made non-static. > > > There are some limitations on converting between static and editable > fields in the Appearance runtime. > (1) The window must have the _noAutoFocus FB attribute. > (2) If a field is ever going to become editable, it must first be > created editable (this sets up additional information internally). > (3) After changing a field to static, you must 'divert' the focus either > to another field or to nowhere (with edit field 0). > > Your demo can be made to work by following those (until now > undocumented) tips. > > > local fn doDialog > dim as long evnt > evnt = dialog( 0 ) > select evnt > case _btnClick > long if button( 1 ) // make EF 1 static > edit field 1, "static",, _statFramed > edit field 2, "",, _framedNoCR > xelse // make EF 2 static > edit field 2, "static",, _statFramed > edit field 1, "",, _framedNoCR > end if > end select > end fn > > > appearance window 1,,,,, _noAutoFocus > > edit field 1,, (10,10)-(100,25), _framedNoCR _usePlainFrame > > // if a field is ever going to be editable, it must be created editable > edit field 2, "static", (120,10)-(220,25), _framedNoCR _usePlainFrame > // change it to be static: > edit field 2,,, _statFramed > // complete the change by setting focus elsewhere: > edit field 1 > > appearance button 1,, 0,,, "1 is static", (10,50)-(120,70),¬ > _kControlCheckBoxAutoToggleProc > on dialog fn doDialog > do > handleevents > until 0 > > > > Robert P. > Thanks for everyone's help on this! Doug Stemen