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 »

good morning mrmarman, iam wondering can i make the blink change color instead of hide text as example real text color will be gray and blink color will be any color
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
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 »

sure you can, only change the canvas.font.color property according to the xboolblink value trigger.

Edit example like below.
(writing from smartphone, sorry for syntax errors)

Kod: Tümünü seç

if xboolBlink or ( Item.SubItems[2] = '' )
      then sender.canvas.font.color := clBlack    
      else sender.canvas.font.color := clred;
  TextOut( xOff, yOff, Item.SubItems[i-1] );
you also can change the font style and background color exr.
Resim
Resim ....Resim
Kullanıcı avatarı
mia
Üye
Mesajlar: 239
Kayıt: 17 Nis 2015 02:18

Re: TVirtualDrawtree

Mesaj gönderen mia »

Kod: Tümünü seç

 // --- Caption and Text --- //
    xOff := Rect.Left;
    for i := 1 to TListView(sender).Columns.Count - 1 do
    begin
      xOff := xOff + TListView(Sender).Columns[i-1].Width;
      yOff := Rect.Top + ((ImageList1.Height-Canvas.TextHeight('H')) div 2);
      if xboolBlink or ( Item.SubItems[2] = '' )
      then TextOut( xOff, yOff, Item.SubItems[i-1] );
in this code its removes the blink text and show it again i dont wana remove it i want make the real text is gray and the blink is in as example red
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
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 »

I added an example above, I'm late sorry.

Edit example like below.
(writing from smartphone, sorry for syntax errors)

Kod: Tümünü seç

if xboolBlink or ( Item.SubItems[2] = '' )
      then sender.canvas.font.color := clBlack    
        else sender.canvas.font.color := clred;
        TextOut( xOff, yOff, Item.SubItems[i-1] );
Resim
Resim ....Resim
Kullanıcı avatarı
mia
Üye
Mesajlar: 239
Kayıt: 17 Nis 2015 02:18

Re: TVirtualDrawtree

Mesaj gönderen mia »

omg thats awesome you are a man from another world .......
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
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're welcome. thank you.
Resim
Resim ....Resim
Kullanıcı avatarı
mia
Üye
Mesajlar: 239
Kayıt: 17 Nis 2015 02:18

Re: TVirtualDrawtree

Mesaj gönderen mia »

another question mrmarman , i put this list inside my client and server application and it works pretty well , but there is some staff iam stuck with it my client and server will have some of image tags to current connected users so if user click some tage its show to him an image beside his name and also show to the client image beside his name as example in this image

Resim

and here is the project after combine
Dosya ekleri
clientserver.rar
(164.61 KiB) 78 kere indirildi
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
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 is easy but if anyone chatting with other one at the same time what do you plan to this? According this answer i will show you the solution.

Basic solution: all users icons in their listview item TObject. Then you find which item index talking with which other index, so you need a subitem more to put index number that item talks which other user's item index.
Resim
Resim ....Resim
Kullanıcı avatarı
mia
Üye
Mesajlar: 239
Kayıt: 17 Nis 2015 02:18

Re: TVirtualDrawtree

Mesaj gönderen mia »

i didnt ctach the logic , there must be on the chat tags to show to other users what this user are doing like if he get blocked from typing or if he is busy
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
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 »

himm. I see..

Then firstly, you will broadcast all user transactions to the server and throught all clients which connected.
One listview has all users avatar.
then you decide one or two subitem to update all this transaction changes.
for example
- subitem 5 shows this user what is doing now? 0:idle 1:writing
- subitem 6 shows with whom? you use this to find the other user image object to draw second avatar beside
Resim
Resim ....Resim
Kullanıcı avatarı
mia
Üye
Mesajlar: 239
Kayıt: 17 Nis 2015 02:18

Re: TVirtualDrawtree

Mesaj gönderen mia »

can i see a little example with attached project when you have free time :(
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
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 »

ok, i will show you after (4) hours. I am on trip over intercity.
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 »

Hi. I'm late,
I have a meeting about tomorrows workflow...

The code below I think example for all off you want to do... I explained from my smartphone before, you know.

I put a ComboBox but you don't need this because ...

Kod: Tümünü seç

  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('123456');                       // subitem 3
    SubItems.Add('-');                            // subitem 4 // Next User Idx (beside)
    SubItems.Add('-');                            // subitem 5 // StateIdx
  end;

... in this sample block the value on SubItem(4) identities which user ItemIndex is talking between, and SubItem(5) identities the user's state. Idle, Out, Writing ext. This subitems will automatically change by you according the transaction process...

This is the drawing code preview :
P.S. : In this example I also make sample for drawing static Images from TImageList image container component without using Resource. Resource is better to use because ImageList's contained all images must be same static size, but in Resource all images can be their original size. This is the difference of them... I prefer resource thing.

Kod: Tümünü seç

    Sender.Canvas.Brush.Style := bsClear;
    // User State Image
      if Item.SubItems[5] <> '-' then
      begin
        ImageList1.Draw( Sender.Canvas, Rect.Left, Rect.Top, StrToInt(Item.SubItems[5]) );
      end;

    // User Image
      NewRect := Rect;
      NewRect.Right  := Sender.Column[0].Width - 4; // for Right Justify
      NewRect.Left   := NewRect.Right  - ImageList1.Width - 4;
      NewRect.Top    := NewRect.Top    + 4;
      NewRect.Bottom := NewRect.Bottom - 4;
      Sender.Canvas.StretchDraw( NewRect, TGIFImage( Item.SubItems.Objects[1]) );

    // Image - Beside User
      if Item.SubItems[4] <> '-' then
      begin
        NewRect := Rect;
        NewRect.Left   := NewRect.Left  + ImageList1.Width; // after StateImage offset
        NewRect.Right  := NewRect.Left  + ImageList1.Width;
        NewRect.Top    := NewRect.Top    + 4;
        NewRect.Bottom := NewRect.Bottom - 4;
        Sender.Canvas.StretchDraw( NewRect, TGIFImage( TListView(Sender).Items[StrToInt(Item.SubItems[4])].SubItems.Objects[1]) );
      end;

    // --- Caption and Text --- //
    xOff := Rect.Left;
    for i := 1 to TListView(sender).Columns.Count-1 do // 1,2,3,4,5,6
    begin
      xOff := xOff + TListView(Sender).Columns[i-1].Width;
      yOff := Rect.Top + ((ImageList1.Height-Canvas.TextHeight('H')) div 2);
      if xboolBlink or ( Item.SubItems[2] = '' )
        then sender.canvas.font.color := clgray
        else sender.canvas.font.color := clred;
      TextOut( xOff, yOff, Item.SubItems[i-1] );
    end;
  end;
Resim
Dosya ekleri
clientserver.rar
Sample Project
(100.67 KiB) 56 kere indirildi
Resim
Resim ....Resim
Kullanıcı avatarı
mia
Üye
Mesajlar: 239
Kayıt: 17 Nis 2015 02:18

Re: TVirtualDrawtree

Mesaj gönderen mia »

its drawing the item image again but this give me idea i will work on it and come back with result tommowro
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
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 »

because they are same image you know. if all items image will difference with users own result will be what you want to do.
Resim
Resim ....Resim
Cevapla