Devex: Unbound and Bounded Image Data Aware ver. 2

Dear All,

After we trying the previous technique, we have face the problem … But, Fortunately we found the way to change it and running smoothly … :mrgreen:

Change the step and you will find the (maybe) good solutions … :mrgreen: but still have one problem when handling the big data aware …

First alias ka hiji kieu :

put one procedure at Public Level:

public
 { Public declarations }
 procedure UpdateGambar(AView: TcxGridTableView; ARecordIndex: integer);

kemudian, create the code like shown below, in previous post we put this code at GetProperties event :

procedure TForm8.UpdateGambar(AView: TcxGridTableView; ARecordIndex: integer);
var
 AValue: string;
 APicture: TPicture;
 AFileName : string;
begin
 AView.DataController.PostEditingData;
 AFileName := 'C:\Manz\Projects\Web\hrms\public_html\images\photo\' +
 VarToStr(AView.DataController.Values[ARecordIndex, cxGrid1DBTableView1nip.Index]) + '.jpg';
 if FileExists(aFileName) then
 begin
   APicture := TPicture.Create;
   try
     APicture.LoadFromFile(AFileName);
     SavePicture(APicture, AValue);
   finally
     FreeAndNil(APicture);
   end;
 end
 else AValue := '';

 AView.DataController.Values[ARecordIndex, cxGrid1DBTableView1Column1.Index] := AValue;
end;

next, at event onPropertiesEditValueChanged at column Image on File, put this code like shown below :

procedure TForm8.cxGrid1DBTableView1Column1PropertiesEditValueChanged(
 Sender: TObject);
var
 AIndex: Integer;
begin
 AIndex := cxGrid1DBTableView1.DataController.FocusedRecordIndex;
 UpdateGambar(cxGrid1DBTableView1, AIndex);
end;

next, at event Form Create put this code like shown below :

procedure TForm8.FormCreate(Sender: TObject);
var
 i: integer;
begin
 for i := 0 to cxGrid1DBTableView1.DataController.RecordCount - 1 do
 UpdateGambar(cxGrid1DBTableView1, i);
end;

After that, you may running your project  …. and … tadaaaa…. , smooth scrolling in the grid without knowing the error will be appear :mrgreen:

But, this the problem when handling the big data aware, cause will be loaded slowly …, you may filtering your data table or query with the limit. :mrgreen:

That’s all folks, … gitu azah dach … sekian dan terima kasih .. jangan lupa donat nya ya weekekekekekek :mrgreen:

Salam Coderz,
😎
Man’z

5 thoughts on “Devex: Unbound and Bounded Image Data Aware ver. 2

  1. kang @Manz,
    itu ada sedikit masalah jika kita Click pada Navigator First ataupun Last, si gambar jadi ga tampil.

    tapi masalah itu dah bisa dipecahkan dengan memanggil FormCreate setelah peng-Click-an navigator First ataupun Last.(ini cuman cara HardSolution). mungkin kang @Manz di utak-atik script-nya bisa lebih elegant lagi.

  2. ikutan nonton juga ah…lagi search error MySQL Dephi4PHP nongol situs om Rahman…sekalian dah mampir..baca2 walau binggung hehehe…sukses selalu om

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s