Here is a section of code that uses FWH 7.10, xHarbour, tSBrowse, and tData ( data object extension ). If I click on the delete button, the browse removes the record, moves to the next record, but the edit control is not updating. I have a feeling I'm missing something ... just not getting through to my brain right now. This code is cut from the full function which has some more edit and label controls.
Tim
FUNCTION list01
// Declare LOCAL variables
LOCAL oDbl, oEdit, lFirst := .F.
// Open the labor rate reference database and index
oDbl := tdata():new(, "erflab" )
oDbl:use()
oDbl:setorder( "erflab" )
oDbl:gotop()
DEFINE DIALOG oDlg RESOURCE "LISTS" OF oWnd TITLE "Labor Rates" FONT oWnd:oFont
// Build the button controls
REDEFINE BUTTON ID 107 of oDlg ACTION( IIF( MsgYesNo( "Do you wish to delete this item ?"), ( oDBl:delete( ),;
oDlg:update()),)) MESSAGE "Delete the current item"
.....
// Build the edit controls
REDEFINE GET oEdit VAR oDbl:charge ID 102 OF oDlg PICTURE "$99999.99" MESSAGE "The charge for this service" UPDATE
REDEFINE GET oDbl:servic ID 103 OF oDlg MESSAGE "A description of the service type" UPDATE
.....
// Create the BROWSE control
REDEFINE BROWSE oLbx1 ID 101 OF oDlg ON CHANGE oDlg:update() UPDATE
oLbx1:setoDBF( oDbl )
add column to oLbx1 header "Charge" data oDbl:charge ALIGN 2,1 size 120
add column to oLbx1 size 25
add column to oLbx1 Header "Service" data oDbl:servic ALIGN 0,1 size 400
.....
// Activate the dialog screen
ACTIVATE DIALOG oDlg
// Close the file
oDbl:close()
RETURN NIL
Delete not updating ?
Delete not updating ?
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
Timm:
I don't know TDATA, but.....
Perhaps you need read the new record to fill the bufer.
oDbl:Read()
just a tip
Regards
I don't know TDATA, but.....
Perhaps you need read the new record to fill the bufer.
oDbl:Read()
just a tip
Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Buffer
tData has a load() method ... it makes no difference ...
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
I have a varying degrees of success with this subject.
I think one of the issues is that when you delete the record it is still visible and the msgyesno() function displays a dialog and the when it goes away the browse gets refreshed.
I ended up using a method/function that does the following.
I think one of the issues is that when you delete the record it is still visible and the msgyesno() function displays a dialog and the when it goes away the browse gets refreshed.
I ended up using a method/function that does the following.
Code: Select all
METHOD DataDelete
local nRecNo, nNewRecNo, lAnswer
// store current record before window has a chance to move record pointer
nRecno := ::oDbf:Recno()
// to stop refresh
::oWnd:disable()
lAnswer := MsgYesNo ( "Delete record: Are you sure ?", "DELETE" )
if lAnswer
// Get next good record if possible
::oDbf:goto( nRecNo )
::oDbf:skip()
if ::oDbf:eof()
::oDbf:goto( nRecNo )
::oDbf:skip( -1 )
endif
nNewRecNo := ::oDbf:recno()
// Now go back and delete record
::oDbf:goto( nRecNo )
::oDbf:delete()
::oDbf:unlock()
// go to new record
::oDbf:goto( nNewRecNo )
endif
// enable window
::oWnd:enable()
sysrefresh()
if lAnswer
// There is a question whether to use upstable() with database object
// or use refresh(). I am using refresh() with database object
//::oBrw:Upstable()
::oBrw:Refresh()
::oBrw:setfocus()
endif
return( nil )
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Skip
I just did that ( prior to your post, but after thinking about Gale's post) and it does indeed force the two records ( browse and data object ) to match up. I'm thinking perhaps this is a problem in TSBrowse as it currently stands.
The oDbf:skip() does work and I can add it throughout the code.
Thanks
The oDbf:skip() does work and I can add it throughout the code.
Thanks
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019