Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Controls on list box items? (https://www.delphipraxis.net/147527-controls-list-box-items.html)

WojTec 10. Feb 2010 18:04


Controls on list box items?
 
Hello,

I created simple, but nice list for display layers on image. This is very simple list based on TListBox with custom drawed items. Look nice, but is not too functional, because can't change layer visibility. And now is problem. Is possible add some clickable control to that list (for example button with image on it from image list component)?

alzaimar 10. Feb 2010 20:37

Re: Controls on list box items?
 
Try a scrollbox. You can create as many controls as you like at runtime.
Delphi-Quellcode:
procedure TForm15.Button1Click(Sender: TObject);
var
  i: Integer;
  CheckBox1: TCheckBox;

begin
  for i := 1 to 20 do begin
    CheckBox1 := TCheckBox.Create(Self);
    with CheckBox1 do begin
      Name := 'CheckBox' + intToStr(i);
      Parent := ScrollBox1;
      Left := 32;
      Top := 2 + 19 * i;
      Width := 97;
      Height := 17;
      Caption := 'CheckBox ' + intToStr(i);
      TabOrder := i - 1;
    end;
  end;
end;

WojTec 11. Feb 2010 10:04

Re: Controls on list box items?
 
No. I need controls on listbox items...

alzaimar 12. Feb 2010 04:49

Re: Controls on list box items?
 
Ah, any specific reason ?

toms 12. Feb 2010 05:00

Re: Controls on list box items?
 
Zitat:

Zitat von WojTec
No. I need controls on listbox items...

Just change the code from alzaimar: Replace TScrollBox with TListbox

alzaimar 12. Feb 2010 05:07

Re: Controls on list box items?
 
But then you have to repaint them yourself.


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:05 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz