Where’s My Last Record?

If you have develop an application (Win32 based I mean) & playing around with great number of records then I suggest you not to let users wasting their time to scroll rows in a list of table & select what record they need time after time. Got what I’m talking about? No? Okay, in a specific case, data transactions committed by an assist of others record, let say a combo or grid of records. It would be nothing if it has 10 records, how about 100 or more? I can guarantee that users will be flustered or the mouse soon will be broken because a long scroll or thousands clicks over it.

I’m saying about to keep last record position in memory & store it on next task. Pretty simple but it helps users effectively, at least minimize the use of scrolling. Here my example on Delphi, with TDBGrid contains records retrieved from a table & assigned with TQuery component. Once TQuery refreshed, record pointer will be at first position. To avoid this, save bookmark pointer before TQuery refreshed & store position in after. Check a code sliced below:

unit ULastRecordPointer;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DBGrids, ComCtrls, DB, DBTables, ExtCtrls, JPEG;

type
TFLastRecordPointer = class(TForm)
...
private
{ Private declarations }
public
{ Public declarations }
end;

var
FLastRecordPointer: TFLastRecordPointer;
...
ptr_record: TBookmark;

implementation

{$R *.dfm}

procedure TFLastRecordPointer.FormRefresh(Sender: TObject);
begin
try
q3.GotoBookmark(ptr_record);
except
//
end;
end;

procedure TFLastRecordPointer.DBGrid1DblClick(Sender: TObject);
begin
ptr_record:=q3.GetBookmark;
end;
end.


The last record position will be saved if users had double clicking on grid (pick a record) & try to store it after the form refreshed. So that the small black triangle will stay on it’s previous position.



With this help of TBookmark, users job will assisted & no more times will be wasted. Furthermore, your users mouse will be much more durable ;-p

Labels: , , ,

Sincerelly,

Eko Wahyudiharto
PS: If you've benefit from this blog,
you can support it by making a small contribution.

Enter your email address:

Delivered by FeedBurner

Post a Comment Bookmark and Share

 

Post a Comment

Leave comments here...