TVirtualDrawtree

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Kullanıcı avatarı
mia
Üye
Mesajlar: 239
Kayıt: 17 Nis 2015 02:18

Re: TVirtualDrawtree

Mesaj gönderen mia »

thank you mrmarman ,, i tried to add items with this approach

Kod: Tümünü seç

  if ExtractFileExt(URLDownload.url) = '.gif' then  // if image is gif
begin
  aGIF := TGifImage.Create;
  aGIF.LoadFromStream(URLDownload.fms);
  aGIF.Transparent := True;
  With ListView.Items.Add do
  begin
    Caption   := '';
    SubItems.Add( strCaption ); // subitem 0
    SubItems.AddObject( 'IMA', TObject( aGif ) ); // subitem 1
    if boolBlink
      then  SubItems.Add( 'blink' ) // subitem 2
      else  SubItems.Add( '' );     // subitem 2
      SubItems.Add( strUniqueID );                  // subitem 3 // UniqueID
    SubItems.Add('-');                            // subitem 4 // Next User Idx (beside)
    SubItems.Add(Currentstatus);                              // subitem 5 // StateIdx
  end;
end;
but didnt success
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
Kullanıcı avatarı
mrmarman
Üye
Mesajlar: 4741
Kayıt: 09 Ara 2003 08:13
Konum: İstanbul
İletişim:

Re: TVirtualDrawtree

Mesaj gönderen mrmarman »

Item allready exists.. You know.
the code below only you need is adding a new user...

Kod: Tümünü seç

SubItems.AddObject( 'IMA', TObject( aGif ) ); // subitem 1

Now you allready have a user now you must Update this SubItem with new picture.

Kod: Tümünü seç

      TObject( SubItems.Objects[1] ).Free;
      SubItems.Objects[1] := TObject( NewBitmap );
Resim
Resim ....Resim
Kullanıcı avatarı
mia
Üye
Mesajlar: 239
Kayıt: 17 Nis 2015 02:18

Re: TVirtualDrawtree

Mesaj gönderen mia »

hmmm , i tried this still same item does not added

aGIF.LoadFromStream(URLDownload.fms);


i have feeling that i have to change the whole add item process or modified something here

Kod: Tümünü seç

procedure TURLDownload.UpdateVisual;
begin
  FMS.Position := 0;
  FImage.Picture.Bitmap.LoadFromStream(FMS);// hmm this 
end;
or even do i have to change Timage to TimageList ?
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
Kullanıcı avatarı
mrmarman
Üye
Mesajlar: 4741
Kayıt: 09 Ara 2003 08:13
Konum: İstanbul
İletişim:

Re: TVirtualDrawtree

Mesaj gönderen mrmarman »

You need to handle picture type inside the download thread.
Because you never know what the user want which type of image.
Resim
Resim ....Resim
Kullanıcı avatarı
mia
Üye
Mesajlar: 239
Kayıt: 17 Nis 2015 02:18

Re: TVirtualDrawtree

Mesaj gönderen mia »

yes i try to

Kod: Tümünü seç

procedure TURLDownload.UpdateVisual;
begin
  FMS.Position := 0;
 if  ExtractFileExt(URl) := '.gif' then
begin
aGIF.LoadFromStream(fms);
end;
 //FImage.Picture.Bitmap.LoadFromStream(FMS);// hmm this
end;
but same results , and this possibly will change all agif images , if iam not wrong .
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
Kullanıcı avatarı
mrmarman
Üye
Mesajlar: 4741
Kayıt: 09 Ara 2003 08:13
Konum: İstanbul
İletişim:

Re: TVirtualDrawtree

Mesaj gönderen mrmarman »

Remember that you created them locally.
Every aGif creation has different pointers and they tied to the each subitem TObject.
Resim
Resim ....Resim
Kullanıcı avatarı
mrmarman
Üye
Mesajlar: 4741
Kayıt: 09 Ara 2003 08:13
Konum: İstanbul
İletişim:

Re: TVirtualDrawtree

Mesaj gönderen mrmarman »

Try this example from scratch. Because you need to cover the TListView TObject issue...

Place a (1) TListView, (1) TImage and (2) TBitBtn(s) on the form. TListView ViewStyle := vsReport and make 3 columns.

Kod: Tümünü seç

procedure TForm1.BitBtn1Click(Sender: TObject);
Var
  aBitmap : TBitmap;
begin
  With TOpenDialog.Create(nil) do begin
    Filter := '*.BMP|*.BMP';
    if execute then
    begin
      aBitmap := TBitmap.Create;
      aBitmap.LoadFromFile(FileName);
      With ListView1.Items.Add do begin
        Caption := 'Capt';
        SubItems.Add( filename );
        SubItems.AddObject( 'IMG', TObject( aBitmap ) );
      end;
    end;
    Free;
  end;
end;

procedure TForm1.BitBtn2Click(Sender: TObject);
Var
  aBitmap : TBitmap;
begin
  if ListView1.Selected = Nil then exit;
  With TOpenDialog.Create(nil) do begin
    Filter := '*.BMP|*.BMP';
    if execute then
    begin
      aBitmap := TBitmap.Create;
      aBitmap.LoadFromFile(FileName);
      TObject( ListView1.Selected.SubItems.Objects[1]).Free;
      ListView1.Selected.SubItems.Objects[1] := TObject( aBitmap );
    end;
    Free;
  end;
end;

procedure TForm1.ListView1SelectItem(Sender: TObject; Item: TListItem;
  Selected: Boolean);
begin
  if ListView1.Selected = Nil then exit;
  Image1.Picture.Bitmap.Assign( TBitmap(ListView1.Selected.SubItems.Objects[1]) );
end;
Resim
Resim ....Resim
Kullanıcı avatarı
mia
Üye
Mesajlar: 239
Kayıt: 17 Nis 2015 02:18

Re: TVirtualDrawtree

Mesaj gönderen mia »

yes correct , but why still the listview cannot add items is what i try is wrong ?
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
Kullanıcı avatarı
mrmarman
Üye
Mesajlar: 4741
Kayıt: 09 Ara 2003 08:13
Konum: İstanbul
İletişim:

Re: TVirtualDrawtree

Mesaj gönderen mrmarman »

for now i don't know. I need to rest for tomorrow. Too much work, less time. I'm quit... good luck for code trace. I believe you will find the spot.
Resim
Resim ....Resim
Kullanıcı avatarı
mia
Üye
Mesajlar: 239
Kayıt: 17 Nis 2015 02:18

Re: TVirtualDrawtree

Mesaj gönderen mia »

yes you need rest , i see your activities in forum you help every body , thank you mrmarman too much i will try to work around this issue
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
Kullanıcı avatarı
mrmarman
Üye
Mesajlar: 4741
Kayıt: 09 Ara 2003 08:13
Konum: İstanbul
İletişim:

Re: TVirtualDrawtree

Mesaj gönderen mrmarman »

thanks. at least I try to be helpful. Too many questions under different issues, conditions rxt.
Resim
Resim ....Resim
Kullanıcı avatarı
mia
Üye
Mesajlar: 239
Kayıt: 17 Nis 2015 02:18

Re: TVirtualDrawtree

Mesaj gönderen mia »

hello mrmarman i closley comes to solve the problem but need little help

here is my adding item code

Kod: Tümünü seç

 With TURLDownload.Create( Image1 ) do
  begin
    Memo1.Lines.Add(' Image Download Thread...  @ThreadID = ' + IntToStr( ThreadID ) );
    URL := strFile;
    Resume;
  end;

  With ListView.Items.Add do
  begin
    Caption   := '';
    SubItems.Add( strCaption ); // subitem 0
    SubItems.AddObject( 'IMA', TObject( aGif ) ); // subitem 1
    if boolBlink
      then  SubItems.Add( 'blink' ) // subitem 2
      else  SubItems.Add( '' );     // subitem 2
      SubItems.Add( strUniqueID );                  // subitem 3 // UniqueID
    SubItems.Add('-');                            // subitem 4 // Next User Idx (beside)
    SubItems.Add(Currentstatus);                              // subitem 5 // StateIdx
  end;
here is my UpdateVisual

Kod: Tümünü seç

procedure TURLDownload.UpdateVisual;
begin
  FMS.Position := 0;
  if ExtractFileExt(url) = '.gif' then  // if image is gif
begin
  aGIF := TGifImage.Create;
  aGIF.LoadFromStream(FMS);
  aGIF.Transparent := True;
  //FImage.Picture.Bitmap.LoadFromStream(FMS);
end;
end;
thread requested successful Image Download Thread... @ThreadID = 4968 , and when i connect with other client i see clients with there image and start lagging too much in the first client

and no items or image added to my client what i did wrong ? project attached to check in action .

and about animated gifs i cannot see it until client disconnect many times .
Dosya ekleri
clientwinnet activex.rar
(92.42 KiB) 78 kere indirildi
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
Kullanıcı avatarı
mia
Üye
Mesajlar: 239
Kayıt: 17 Nis 2015 02:18

Re: TVirtualDrawtree

Mesaj gönderen mia »

i still cannot get it work properly can i get help from the professional ? :D
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
Kullanıcı avatarı
mrmarman
Üye
Mesajlar: 4741
Kayıt: 09 Ara 2003 08:13
Konum: İstanbul
İletişim:

Re: TVirtualDrawtree

Mesaj gönderen mrmarman »

This week i'm on field production. So it's hard to find time for sit by my notebook.
Please be tracing the code with work flow. You find the best way
Resim
Resim ....Resim
Kullanıcı avatarı
mia
Üye
Mesajlar: 239
Kayıt: 17 Nis 2015 02:18

Re: TVirtualDrawtree

Mesaj gönderen mia »

i will keep trying mrmarman , yes i know its possibly season of Ramadan you will be busy in those monthes .
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
Cevapla