RECORD property anomaly (OpenInsight 32-Bit)
At 23 DEC 2005 02:00:23PM Wayne Shepard wrote:
I suppose I'm the only one working today…
Okay, so I have a field in a window. When I read the record and enter a value in the field, then call Get_Property(@window,"RECORD"), the new value is in the record returned. However, if I read the record and populate the field programmatically (both calling a popup in the CLICK event of a button and returning the value to the edit field's TEXT property, and calling Set_Property to set the TEXT value) the value returned from the RECORD property is the original value, not the new one. How does one assign a value to a field such that the RECORD property knows it is there?
Happy New Year.
Wayne
At 23 DEC 2005 02:19PM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:
You could try using DEFPROP instead of TEXT. This might make a difference.
World leaders in all things RevSoft
At 23 DEC 2005 05:33PM Gerald Lovel wrote:
I usually set INVALUE instead of TEXT, as this forces the data conversion and storage for a control. I have seen plenty of circumstances where the TEXT property of a control is displayed, but the INVALUE is blank.
At 23 DEC 2005 07:55PM Warren Auyong wrote:
My explorations into the RECORD property indicated the RECORD property often does not get updated until after a LOSTFOCUS event. Try forcing a LOSTFOCUS on the control you update in your procedure.
At 23 DEC 2005 08:00PM [email protected]'s Don Bakke wrote:
Sending a LOSTFOCUS might not be helpful if he is programmatically updating his form. OI will not think the data is changed. This is a common problem with people use popups to change the Key ID and then wonder why the form won't read when they lose focus.
At 24 DEC 2005 12:16PM Warren Auyong wrote:
In that instance setting focus to the control before setting the property with the popup return data followed by a lostfocus usually works (but not always). Just for consistancy it's best to generate the read event.
One could always:
atrecord=Get_Property(@WINDOW,'RECORD'), manipulate atrecord and set_property on associated controls and then orecord=Set_Property(@WINDOW,'RECORD',atrecord). It gets a little tricky but the data can be kept in sync. I populate a form using imported CSV data in this manner. RevSoft and Sprezzatura have routines to populate a form via a pseudo @RECORD. RevSoft makes theirs available as part of the porting lab so it may not be available for Works Members.
At 25 DEC 2005 05:23PM Barry Stevens wrote:
Hear are 2 kludge routines I use to speed up ASREV conversions when lasy.
function GetAtRecord(Window,AtRecord,AtId) * * This will build AtRecord and AtId from window controls * * *Function returns AtRecord * *passes back AtRecord and AtId * declare function Get_property,Utility $insert oiwin_equates WinId=Window ;* "") keyControls=" for keyNbr=1 to keyCount keyControls := keyMap@ : @RM next keyNbr keyControls-1,1=" AtId=get_property( keyControls, 'DEFPROP') if AtId-1,1=@RM then AtId-1,1=" end convert @RM to '*' in AtId AtRecord=" Object=";Property=";Value=";CoOrds=" RowMaps=RowMaps@ FldNos=" loop while RowMaps RowMap=RowMaps1,@vm RowMaps1,col2()=" Pos=RowMap Control=MasterRowMap@ CoOrd=MasterRowMap@ FldNo=RowMap if FldNo ] 0 then FldNos=FldNo Object:=@rm:Control Property:=@rm:"INVALUE" CoOrds:=@rm:CoOrd end repeat Object1,1=" Property1,1=" CoOrds1,1=" Value=get_property(Object,Property,CoOrds) Cnt=count(Value,@rm)+(Value"") for X=1 to Cnt Data=field(Value,@rm,X) AtRecord]=Data next X * *Remove Trailing @vm * Cnt=count(AtRecord,@fm)+(AtRecord"") for X=1 to Cnt vmCnt=count(AtRecord,@vm) + (AtRecord
) GotValue=0 for cVm=vmCnt to 1 step -1 until GotValue if AtRecord=' then AtRecord=delete(AtRecord,X,cVm,
) end else GotValue=1 end next cVm next X return AtRecord ***subroutine SetAtRecord(Window,AtRecord)
*
*Sets window's controls with values from AtRecord
*
declare function Get_property,Utility
declare subroutine set_property
$insert oiwin_equates
WinId=Window ;*
Control=MasterRowMap@CoOrd=MasterRowMap@FldNo=RowMapif FldNo ] 0 thenFldNos=FldNoObject:=@rm:ControlProperty:=@rm:"INVALUE"Value:=@rm:AtRecordCoOrds:=@rm:CoOrdendrepeat
Object1,1="
Property1,1="
Value1,1="
CoOrds1,1="
set_property(Object,Property,Value,CoOrds)
Foo=utility("CURSOR",OrigCur)
return
At 25 DEC 2005 10:49PM [email protected]'s Don Bakke wrote:
Warren,
Yes, I'm quite aware of that workaround. However, it doesn't resolve the general issue Wayne would be facing.
At 12 JAN 2006 04:45PM Karen Oland wrote:
I take it you don't use these routines on windows that have edit tables? I tested the code and only the first row of info was added to the tables (all multivalues were stripped/ignored).