Browsing and edit dataobjects

This forum is for eXpress++ general support.
Post Reply
Message
Author
Wolfgang Ciriack
Posts: 479
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Browsing and edit dataobjects

#1 Post by Wolfgang Ciriack »

Hello Roger,

i try to get rid of some temporary DBF-Files, which i used for do some editing.
So i try to use dataobjects for that.
I changed my browsing successful (in the attached sample aLeist is the Array with objects, see Tabpage 3)

Now i try to edit the different objects (Tabpage 2).
My problem is, that the DCGET vars are not refreshed, when i change between the positions (Next Pos, Last Pos buttons or on Tabpage 3 the Browse ItemSelected).
I see the positions right changing (Pos xx of yy) but the GETS are always showing the content of the first object.

Can you please show me, what i am doing wrong or what is missing ?
The sample is attached.

Thank you.
Best regards and greetings from Berlin
Wolfgang
Attachments
ForRoger.zip
(294.7 KiB) Downloaded 147 times
_______________________
Best Regards
Wolfgang

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Browsing and edit dataobjects

#2 Post by rdonnay »

Wolfgang -

Do not create a new record object every time you move the TP record pointer.
Instead, simply use DC_DbScatter() to load the new data into the existing record object.
This is due to the fact that your DCGET objects are bound to the original record object.

Code: Select all

  ;// ACTION {|| oLstRec := TxtNextPos(oLstRec), DC_GetRefresh(Getlist), SetAppFocus(oAnr)} ;
  ACTION {|| TxtNextPos(oLstRec), DC_GetRefresh(Getlist), SetAppFocus(oAnr)} ;

Static Function TxtNewPos(oRec)
// LOCAL oRec

if nPosLeist > Len(aLeist)
//   oRec := tp->(DC_DbRecord():New())
//   tp->(DbGoBottom())
//   tp->(DbSkip())

   tp->(dbGoto(0))
   tp->(DC_DbScatter(oRec))
   AAdd(aLeist, {oRec, 0, .T.})
	oRec:Pos      := Len(aLeist)
	oRec:KundNum  := oTERec:KundNum
	oRec:Name1    := oTERec:Name1
	oRec:LfDat    := oTERec:TxtDat
	nGesPos       := Len(aLeist)
   nPosLeist     := Len(aLeist)
else
   tp->(DC_DbScatter(oRec))
   // oRec := aLeist[nPosLeist, 1]
endif
return (oRec)
Here is modified code:

http://bb.donnay-software.com/ciriack/test.zip
The eXpress train is coming - and it has more cars.

Wolfgang Ciriack
Posts: 479
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: Browsing and edit dataobjects

#3 Post by Wolfgang Ciriack »

Hello Roger,
sorry, but that does not work for me.
I load all existing records in aLeist and only want to edit these different dataobjects of aLeist.
Only if there is a additional object, i add an (empty) object to aLeist for editing.
If then all is done i will write these objects back to the database (or if aLeist[n, 2] is 0, then add this as a new record).
Is there no possibilty, to set the content of the GETS to the different objects in aLeist ?
Your DC_DbScatter loads the content from the database, i like to load the content from aLeist.
_______________________
Best Regards
Wolfgang

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Browsing and edit dataobjects

#4 Post by rdonnay »

Regardless of how you do it, you still must use the original pointer to the DCGET record object if you want DC_GetRefresh() to refresh the data.

Otherwise, you will need to pass down a pointer to the DCGET object itself and use oGet:_assign(oNewRecordObject).
The eXpress train is coming - and it has more cars.

Wolfgang Ciriack
Posts: 479
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: Browsing and edit dataobjects

#5 Post by Wolfgang Ciriack »

Thank you Roger,
i will redesign my concept.
_______________________
Best Regards
Wolfgang

Post Reply