Within the WRITE event for a form the command:
ret_controls=Get_Property(@WINDOW,"RECORD")
doesn't return the correct control value for any controls that have events.
For instance, there are 30 controls in the form, and all have database associated columns. Two of these controls have events, and the RET_CONTROLS variable as outlined above doesn't return the correct value for those 2 controls. (The values returned are the @RECORD vales).
The 2 controls are an edit line (LOSTFOCUS event) and an edit table (INSERTROW,DELETEROW & POSCHANGED events).
Peter
Peter,
What version of OI?
dbakke@srpcs.com
Don,
Sorry, I should show what OI version.
I am using version 3.2
Peter
The 2 controls are an edit line (LOSTFOCUS event)
Hmmm, I'm not exactly sure about this one. Are you positive that nothing in the LOSTFOCUS event could be interfering? Are you playing with the GOTFOCUS_VALUE property or anything similar? What happens if you 1) remove the event completely, or 2) keep the event but rem out any real coding?
…and an edit table (INSERTROW,DELETEROW & POSCHANGED events).
Now this is somewhat expected. OI didn't update the RECORD property correctly with edittables, especially when doing an insertion or deletion of a row up to version 3.2. This was corrected in 3.3 or 3.31.
dbakke@srpcs.com
Don,
]The 2 controls are an edit line (LOSTFOCUS event)
]Hmmm, I'm not exactly sure about this one. Are ]you positive that nothing in the LOSTFOCUS event ]could be interfering? Are you playing with the
]GOTFOCUS_VALUE property or anything similar?
Here is all the code in the LOSTFOCUS:
Declare function RowExists
Supporter_Number=.SUPPORTER_NUMBER-]text
Name=.NAME-]text
Exists=RowExists("SUPPORTERS",Supporter_Number)
If exists then
end else
Salutation=.SALUATION-]textIf Salutation=" thentextInitials=.INITIALS-]textIf thenIf Initials=" then .SALUTATION-]text=Friends"Endend else.SALUTATION-]text=Title:" ":Name endendend
] What happens if you 1) remove the event completely, or 2) keep the event but rem out any real coding?
Will try this and let advise.
]…and an edit table (INSERTROW,DELETEROW & ]POSCHANGED events). Now this is somewhat ]expected. OI didn't update the RECORD property
]correctly with edittables, especially when doing ]an insertion or deletion of a row up to version ]3.2. This was corrected in 3.3 or 3.31.
Thanks, will keep this in mind.
Peter
Peter,
Based on your LOSTFOCUS script I'd say that the problem is the use of the TEXT property when updating your controls. TEXT does not update the RECORD property because it only affects the control itself and not the underlying database column (at least until the record is written.)
Instead you should use either the DEFPROP property (for already output converted data) or the INVALUE property (for internally formatted data). Then the RECORD property will be automatically updated as well.
dbakke@srpcs.com
Peter,
I forgot to mention something else which may just be a typo when you copied your LOSTFOCUS event code:
Line #7 says:
Salutation=.SALUATION-]text
I'm sure it's supposed to read:
Salutation=.SALUTATION-]text
You may want to double-check your code on this.
dbakke@srpcs.com
Peter,
At the end of your LOSTFOCUS code you should have:
return 1Cameron. Revelation
Cameron,
Thanks for the tip on RETURN. Is there a general rule for when to use value 0 and when to use 1 ? Is it dependant upon the event chain, as to what event will 'stop' with a value 1 ?
Peter
Don,
Will check out the spelling on 'Salutation', thanks.
With TEXT and DEFPROP, I thought it was 'safe' to use TEXT. At WRITE time, aren't just POS & TABLE properties used to 'line up' each control on the form to columns in the Database ?
Peter
Peter,
If you "return 1", the event chain continues. If you "return 0", it stops. If you "forward_event(…)", it executes the rest of the event chain immediately. Most events don't have "the rest of the event chain", but GOTFOCUS, LOSTFOCUS, POSCHANGED, CLOSE, READ, WRITE, etc. do.
Cameron. Revelation
Cameron,
Thanks for clearing up the return values with event chaining, etc.
Peter
Peter,
With TEXT and DEFPROP, I thought it was 'safe' to use TEXT. At WRITE time, aren't just POS & TABLE properties used to 'line up' each control on the form to columns in the Database ?
It's safe for WRITE purposes, yes, but if you need to access the latest changes in the RECORD property before the WRITE (for instance, printing a form) then TEXT won't do you any good.
dbakke@srpcs.com
Don,
Thanks, I see the difference now. Will use DEFPROP
in preference to TEXT.
Peter