ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 DBCtrlGrid and ImageEnView
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

kouzen128k

2 Posts

Posted - Mar 22 2016 :  19:53:12  Show Profile  Reply
Hi trying test , I wish to attain a layout of image inside a DBCtrlGrid an hope to use the AysncMode of the imageEn.IO to load pictures in the background in Delphi 6, However I am having problems with this the picture loads as expected however when you close the app it freezed about 1 minute most of the time the form becomes white and unresponsive,. bellow is the goal I wish to attain layout



P.S. it doesn't need to be the exact effects but all i want is an image and can be some text overlay, the shadow and the rounded mask can be ignored this is only an idea

I need to put captions for product names and prices also and bellow here's my test code, the ImageEnView was placed inside the DBCtrlGrid for it to iterate.



object Form1: TForm1
  Left = 192
  Top = 107
  Width = 696
  Height = 480
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  OnShow = FormShow
  PixelsPerInch = 96
  TextHeight = 13
  object DBCtrlGrid1: TDBCtrlGrid
    Left = 16
    Top = 16
    Width = 665
    Height = 417
    ColCount = 5
    PanelHeight = 139
    PanelWidth = 129
    TabOrder = 0
    RowCount = 3
    OnPaintPanel = DBCtrlGrid1PaintPanel
    object ImageEnView1: TImageEnView
      Left = 8
      Top = 8
      Width = 114
      Height = 124
      ParentCtl3D = False
      ImageEnVersion = '3.1.2'
      EnableInteractionHints = True
      TabOrder = 0
    end
  end
  object ADOQuery1: TADOQuery
    Parameters = <>
    Left = 232
    Top = 104
  end
end

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ieview, imageenview, dbcgrids, DB, ADODB;

type
  TForm1 = class(TForm)
    DBCtrlGrid1: TDBCtrlGrid;
    ImageEnView1: TImageEnView;
    ADOQuery1: TADOQuery;
    procedure DBCtrlGrid1PaintPanel(DBCtrlGrid: TDBCtrlGrid;
      Index: Integer);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.DBCtrlGrid1PaintPanel(DBCtrlGrid: TDBCtrlGrid;
  Index: Integer);
begin
        ImageEnView1.IO.AsyncMode := True;
        ImageEnView1.IO.LoadFromURL('http://www.example.com/'+ADOQuery1.fieldbyName('pic_file').AsString+'.jpg');
end;

procedure TForm1.FormShow(Sender: TObject);
begin
        ADOQuery1.Close;
        ADOQuery1.Open;
end;

end.



Can this be possible? or am i using the wrong components to achieve this? the pictures will be in a central network, I wish to use the multi-thread loading because if not the program most of the time hangs when getting many pictures from the server.

xequte

38943 Posts

Posted - Mar 27 2016 :  21:27:31  Show Profile  Reply
Hi

What is the value of ThreadsCount at the time you close? Does it close normally if you wait for ThreadsCount to be zero?

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

kouzen128k

2 Posts

Posted - Mar 27 2016 :  23:23:44  Show Profile  Reply
hi, thank you for the reply, the threadcount on the FormCloseQuery event is not zero, sometimes its 59, 12, 4 or 3, how can i code to close when threadcount is zero? can i assign the thread cancel loading forcibly?
Go to Top of Page

xequte

38943 Posts

Posted - Mar 28 2016 :  17:27:57  Show Profile  Reply
Hi

You can cancel all threads by calling IO.WaitThreads( True ). Though this should happen automatically when destroying the control. Try calling it in your close event.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: