| 234 |
if IWGrid1.Visible = true then |
if IWGrid1.Visible = true then |
| 235 |
IWLabel6.Visible := Filter |
IWLabel6.Visible := Filter |
| 236 |
else |
else |
| 237 |
DM.FDTable2.Locate('SERIAL',UserSession.Serial); |
DM.FDTable2.Locate('SERIAL', UserSession.Serial); |
| 238 |
end; |
end; |
| 239 |
|
|
| 240 |
procedure TIWForm1.IWButton1Click(Sender: TObject); |
procedure TIWForm1.IWButton1Click(Sender: TObject); |
| 388 |
|
|
| 389 |
procedure TIWForm1.LoadImage; |
procedure TIWForm1.LoadImage; |
| 390 |
var |
var |
|
s: TStream; |
|
|
png: TPngImage; |
|
| 391 |
pic: TIWImage; |
pic: TIWImage; |
| 392 |
i: Integer; |
i: Integer; |
| 393 |
j: Integer; |
j: Integer; |
| 395 |
label label1; |
label label1; |
| 396 |
begin |
begin |
| 397 |
ClearImage; |
ClearImage; |
| 398 |
png := TPngImage.Create; |
if Thumbnail = true then |
| 399 |
try |
begin |
| 400 |
if Thumbnail = true then |
i := DM.FDTable2.RecordCount div IWGrid1.ColumnCount; |
| 401 |
begin |
if DM.FDTable2.RecordCount mod IWGrid1.ColumnCount > 0 then |
| 402 |
i := DM.FDTable2.RecordCount div IWGrid1.ColumnCount; |
inc(i); |
| 403 |
if DM.FDTable2.RecordCount mod IWGrid1.ColumnCount > 0 then |
IWGrid1.RowCount := i; |
| 404 |
inc(i); |
if DM.FDTable2.Filtered = false then |
| 405 |
IWGrid1.RowCount := i; |
DM.FDTable2.Last |
| 406 |
if DM.FDTable2.Filtered = false then |
else |
| 407 |
DM.FDTable2.Last |
DM.FDTable2.FindLast; |
| 408 |
else |
for i := 0 to IWGrid1.RowCount - 1 do |
| 409 |
DM.FDTable2.FindLast; |
for j := 0 to IWGrid1.ColumnCount - 1 do |
| 410 |
for i := 0 to IWGrid1.RowCount - 1 do |
begin |
| 411 |
for j := 0 to IWGrid1.ColumnCount - 1 do |
if DM.FDTable2.Filtered = false then |
| 412 |
begin |
begin |
| 413 |
if DM.FDTable2.Filtered = false then |
if DM.FDTable2.Bof = true then |
|
begin |
|
|
if DM.FDTable2.Bof = true then |
|
|
goto label1; |
|
|
end |
|
|
else if DM.FDTable2.Found = false then |
|
| 414 |
goto label1; |
goto label1; |
| 415 |
if DM.FDTable2.FieldByName('THUMBNAIL').IsNull = false then |
end |
| 416 |
begin |
else if DM.FDTable2.Found = false then |
| 417 |
s := DM.FDTable2.CreateBlobStream |
goto label1; |
| 418 |
(DM.FDTable2.FieldByName('THUMBNAIL'), bmRead); |
pic := TIWImage.Create(IWGrid1); |
| 419 |
try |
UserSession.FieldToImg(pic.Picture, |
| 420 |
png.LoadFromStream(s); |
DM.FDTable2.FieldByName('THUMBNAIL')); |
| 421 |
finally |
IWGrid1.Cell[i, j].Control := pic; |
| 422 |
s.Free; |
t := DM.FDTable2.FieldByName('NAME').AsString; |
| 423 |
end; |
if Length(t) > 10 then |
| 424 |
pic := TIWImage.Create(IWGrid1); |
t := Copy(t, 1, 8) + '..'; |
| 425 |
pic.Picture.Assign(png); |
IWGrid1.Cell[i, j].Tag := |
| 426 |
IWGrid1.Cell[i, j].Control := pic; |
Pointer(DM.FDTable2.FieldByName('SERIAL').AsInteger); |
| 427 |
end; |
IWGrid1.Cell[i, j].Text := t; |
| 428 |
t := DM.FDTable2.FieldByName('NAME').AsString; |
IWGrid1.Cell[i, j].Alignment := taCenter; |
| 429 |
if Length(t) > 10 then |
IWGrid1.Cell[i, j].Clickable := true; |
| 430 |
t := Copy(t, 1, 8) + '..'; |
if DM.FDTable2.Filtered = false then |
| 431 |
IWGrid1.Cell[i, j].Tag := |
DM.FDTable2.Prior |
| 432 |
Pointer(DM.FDTable2.FieldByName('SERIAL').AsInteger); |
else |
| 433 |
IWGrid1.Cell[i, j].Text := t; |
DM.FDTable2.FindPrior; |
| 434 |
IWGrid1.Cell[i, j].Alignment := taCenter; |
end; |
| 435 |
IWGrid1.Cell[i, j].Clickable := true; |
label1: |
| 436 |
if DM.FDTable2.Filtered = false then |
end |
| 437 |
DM.FDTable2.Prior |
else if DM.FDTable2.Locate('SERIAL', UserSession.Serial, []) = true then |
| 438 |
else |
UserSession.FieldToImg(IWFrame8.IWImage1.Picture, |
| 439 |
DM.FDTable2.FindPrior; |
DM.FDTable2.FieldByName('IMAGE')); |
|
end; |
|
|
label1: |
|
|
end |
|
|
else if DM.FDTable2.Locate('SERIAL', UserSession.Serial, []) = true then |
|
|
if DM.FDTable2.FieldByName('IMAGE').IsNull = false then |
|
|
begin |
|
|
s := DM.FDTable2.CreateBlobStream |
|
|
(DM.FDTable2.FieldByName('IMAGE'), bmRead); |
|
|
try |
|
|
png.LoadFromStream(s); |
|
|
finally |
|
|
s.Free; |
|
|
end; |
|
|
IWFrame8.IWImage1.Picture.Assign(png); |
|
|
end |
|
|
else |
|
|
IWFrame8.IWImage1.Picture.Assign(nil); |
|
|
finally |
|
|
png.Free; |
|
|
end; |
|
| 440 |
Randomize; |
Randomize; |
| 441 |
DM.FDTableView.Filter := 'DATE > '+QuotedStr(DateTimeToStr(Date-10)); |
DM.FDTableView.Filter := 'DATE > ' + QuotedStr(DateTimeToStr(Date - 10)); |
| 442 |
DM.FDTableView.First; |
DM.FDTableView.First; |
| 443 |
DM.FDTableView.MoveBy(Random(DM.FDTableView.RecordCount)); |
DM.FDTableView.MoveBy(Random(DM.FDTableView.RecordCount)); |
| 444 |
if DM.FDTableView.FieldByName('THUMBNAIL').IsNull = false then |
UserSession.FieldToImg(IWImage1.Picture, |
| 445 |
begin |
DM.FDTableView.FieldByName('THUMBNAIL')); |
|
s := DM.FDTableView.CreateBlobStream |
|
|
(DM.FDTableView.FieldByName('THUMBNAIL'), bmRead); |
|
|
png := TPngImage.Create; |
|
|
try |
|
|
png.LoadFromStream(s); |
|
|
IWImage1.Picture.Assign(png); |
|
|
finally |
|
|
png.Free; |
|
|
s.Free; |
|
|
end; |
|
|
end; |
|
| 446 |
IWLabel4.Caption := DM.FDTableView.FieldByName('NAME').AsString; |
IWLabel4.Caption := DM.FDTableView.FieldByName('NAME').AsString; |
| 447 |
end; |
end; |
| 448 |
|
|