[DUG] Bookmark

Laurie.. lbisman at clear.net.nz
Wed Dec 17 16:41:01 NZDT 2008


It looks as though it's a refresh problem - I'll try some things and get back to you

Laurie..
  ----- Original Message ----- 
  From: Marshland Engineering 
  To: delphi at delphi.org.nz 
  Sent: Wednesday, December 17, 2008 9:17 AM
  Subject: [DUG] Bookmark


  I have a strange problem. I have a dbgrid and am moving records up and down with buttons. (Delphi4)

  The routine works 

  If I uncomment the bookmark, it displays wrong figures in the seq and seq2 columns on the record I was moving.

  If I move a line and close the application, reopen it,  the figures are correct. It seem that only the display is incorrect when moving.


  SEQ   SEQ2   Desc
  20      20        Tool Select
  25      25        Coolant on
  30      30        Feed Rate

  If I move "Coolant on" down I get 

  20      20        Tool Select
  30      30        Coolant on
  25      25        Feed Rate
  30      30       Coolant on

  Close the application and reopen

  20      20        Tool Select
  25      25        Feed Rate
  30      30        Coolant on

  If I comment out the Bookmark, it works correctly but leaves me at the bottom of the list. 

  procedure OperSort(sBM: String);
  var
     iSeq : Integer;
  begin
     with dm.tblOper do begin
        IndexName := 'OPERSEQ2';           // Swop to this new sort order
        Open;
        First;                               // go to the top
        iSeq:=5;                           // first record is 5
        while not Eof do begin
           edit;
           dm.tblOper['SEQ']:= iSeq;       // increase each recod by 5
           iSeq:=iSeq+5;
           dm.tblOper.post;
           dm.tblOper.next;
        end;
        close;
        IndexName := 'OPERSEQ';            // set back to the original order
        Open;
        First;
        while not Eof do begin
           edit;
           dm.tblOper['SEQ2']:= dm.tblOper['SEQ'];  // Update secondary index. 
           Post;
           Next;
        end;
        //  BookMark:=sBM;
     end;
  end;

  procedure TfMain.bMainDownClick(Sender: TObject);
  var
    iSeq: Integer;
    sBookMark :String;
  begin
     iSeq:=dm.tblOper.FieldByName('SEQ').AsInteger;  //get the current sequence number
     with dm.tblOper do begin
        iSeq:=iSeq+6;                             // Increase by 6
        edit;                                            // tbl seq numbers are multiple of 5's
        dm.tblOper['SEQ2']:= iSeq;
        Post;
        sBookMark:= BookMark;             // Position Cursor at current record.
        Close;
        OperSort(sBookMark);
     end;
  end;



------------------------------------------------------------------------------


  _______________________________________________
  NZ Borland Developers Group - Delphi mailing list
  Post: delphi at delphi.org.nz
  Admin: http://delphi.org.nz/mailman/listinfo/delphi
  Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: unsubscribe


------------------------------------------------------------------------------



  No virus found in this incoming message.
  Checked by AVG - http://www.avg.com 
  Version: 8.0.176 / Virus Database: 270.9.18/1851 - Release Date: 12/16/2008 8:53 AM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20081217/73c1dd22/attachment.html 


More information about the Delphi mailing list