home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.paradox      To crash or not to crash, asks Borland      9,834 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,245 of 9,834   
   Jeff Shoaf to Bill McCray   
   Re: changevalue and newvalue   
   08 Jun 08 09:36:02   
   
   From: jeffshoaf@alltel.net   
      
   I've always called this type of construct a "one-shot" - maybe due to my   
   electronics background.   
      
   Note that the var declaration needs to be placed above the event   
   declaration or it will be cleared each time the event runs. Also note   
   that you need to check to see if it's been assigned a value before   
   checking the value or you'll get an unassigned variable error.   
      
   var   
       flag   logical   
   endVar   
      
   ChangeValue()  ; This is the first line of code that's automatically   
                   ; created by Paradox - I can't remember the full line   
      
   if not flag.isAssigned() then   
       flag = false   
   endIf   
      
   if not flag then   
         flag = true   
         ; your code   
         flag = false   
   endIf   
      
      
   Bill McCray wrote:   
   > If you are concerned about changes leading to back and forth   
   > triggering, define a Logical variable in the Var section for each   
   > field.  Let's call it "Flag".  Use Flag to avoid repeating an   
   > operation.   
   >   
   > If Not Flag Then   
   >    Flag = True   
   >    ; Put your changes here   
   >    Flag = False   
   > EndIf   
   >   
   > If you enter this code a second time, the changes aren't made   
   > preventing an endless loop.   
   >   
   > Bill   
   >   
   > On Sat, 7 Jun 2008 12:32:42 -0400, "Craig"   
   >  wrote:   
   >   
   >> Jeff and Fred,   
   >> Thanks for your help. I used Jeff's at this point because of the simplicity.   
   >> Fred's suggestion, however, may come in handy. With the two fields, if I   
   >> change field 2, field 1 changes. Suppose I want the reverse to also happen?   
   >> I am concerned that it will go back and forth.   
   >> Craig   
   >>   
   >> "Fred Z"  wrote in message   
   >> news:c1fcac80-c199-4d9f-afae-e5d0302f3955@t54g2000hsg.googlegroups.com...   
   >>> You could use the reason method with the following example taken   
   >>> directly from Pdx help.   
   >>>   
   >>> The following example assumes that a form contains a multi-record   
   >>> object bound to the Orders table, and that the Ship_VIA field is a set   
   >>> of radio buttons. Assume also that the form is in Edit mode. The   
   >>> newValue method for Ship_VIA displays a message indicating why   
   >>> newValue was called. When the form opens, the Reason will be   
   >>> StartupValue.   
   >>>   
   >>> ; Ship_VIA::newValue   
   >>> method newValue(var eventInfo Event)   
   >>> ; show why the newValue method was called   
   >>> msgInfo("newValue reason",   
   >>>    iif(eventInfo.reason() = StartupValue, "StartupValue",   
   >>>    iif(eventInfo.reason() = FieldValue, "FieldValue", "EditValue")))   
   >>> endMethod   
   >>>   
   >>> When the user scrolls through the table or clicks the nextRec button,   
   >>> the Reason will be FieldValue.   
   >>>   
   >>> ; nextRec::pushButton   
   >>> method pushButton(var eventInfo Event)   
   >>> action(DataNextRecord)    ; this triggers a newValue for Ship_Via   
   >>>                          ; with a Reason constant FieldValue   
   >>> endMethod   
   >>>   
   >>> When the user chooses a different radio button on Ship_VIA or clicks   
   >>> the changeRadio button, the Reason will be EditValue.   
   >>>   
   >>> ; changeRadio::pushButton   
   >>> method pushButton(var eventInfo Event)   
   >>> ORDERS.Ship_Via = "US Mail"    ; this triggers a newValue for Ship_Via   
   >>>                               ; with a Reason of EditValue   
   >>> endMethod   
   >>>   
   >>> Or, if you want to test for the change in a tableframe try   
   >>>   
   >>> method action(var eventInfo ActionEvent)   
   >>> var   
   >>> vActionID smallint   
   >>> endvar   
   >>>   
   >>> vActionID=eventinfo.id()   
   >>>   
   >>> if vActionID=DataPostRecord or vActionID=DataUnlockRecord {plus maybe   
   >>> a test to see if the record actually changed}   
   >>> then   
   >>> ............your code here   
   >>> endif   
   >>>   
   >>> Good luck   
   >   
   > ----------------------------------------------------------------   
   > Reverse parts of the user name and ISP name for my e-address   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca