Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Nochmal CheckListBox -ScrollBar (https://www.delphipraxis.net/21995-nochmal-checklistbox-scrollbar.html)

HomerGER 11. Mai 2004 06:22


Nochmal CheckListBox -ScrollBar
 
Hallo

Wie bekomme ich eine Vertikal Srcollbar hin :gruebel:
Oder vielmehr warum hat das blöde ding keine ?

Dax 11. Mai 2004 06:24

Re: Nochmal CheckListBox -ScrollBar
 
Um herauszufinden, ob es überhaupt welche hat, checke mal den Property-Editor. ;)
Nein, kleiner scherz.
Fülle die Box so lange mit Einträgen, bis entweder eine Scrollbaar erscheint oder man den letzten eintrag nicht mehr sieht.
Wenn keine da ist:

HomerGER 11. Mai 2004 06:33

Re: Nochmal CheckListBox -ScrollBar
 
lieber Dax
auf die Länge kommt es an - egal was dir die Mädels auch sagen

nein kleiner scherz zurück


es geht um die Eintraglänge, die wird abgehackt
und mit ein halben Eintrag kommt man nicht weit, schon garnicht bei den Mädels :?

die Horizontale Scrollbar ist ja da, nur nicht die vertikale

SirThornberry 11. Mai 2004 06:41

Re: Nochmal CheckListBox -ScrollBar
 
So bekommst du die horizontale Scrollbar hinn..
Delphi-Quellcode:
var LCount, LBreit, Ltmpbreit: Integer;
begin
  LBreit := 0;
  for LCount := 0 to CheckListBox1.Items.Count - 1 do
  begin
    Ltmpbreit := Checklistbox1.Canvas.TextWidth(CheckListBox1.Items.Strings[LCount]) + 25;
    if Ltmpbreit > LBreit then LBreit := LtmpBreit;
  end;
  SendMessage(Checklistbox1.Handle, LB_SetHorizontalExtent, LBreit, LongInt(0));

ggfan 20. Mär 2005 11:53

Re: Nochmal CheckListBox -ScrollBar
 
Soory aber ich bin noch ein totaler Anfänger.
In welche Prozedur kommt der Code oben denn rein.

KreppDel 10. Nov 2005 06:25

Re: Nochmal CheckListBox -ScrollBar
 
Hab ich mal irgendwo gefunden! Ich glaub, dat is ab D6!
Hoffe es hilft.


Delphi-Quellcode:
uses
  CheckLst;

function CheckListBoxHoriScrollBar(CLB: TCheckListBox);
var
  i, nMaxWidth, nItemWidth : integer;
begin
  nMaxWidth := CLB.ClientWidth;
  for i := 0 to CLB.Items.Count - 1 do
  begin
    nItemWidth := Length(CLB.Items[i]) * 5 + 20;
    if (nItemWidth > nMaxWidth) then
    nMaxWidth := nItemWidth;
  end;
  if (nMaxWidth > CLB.ClientWidth) then
    CLB.ScrollWidth := nMaxWidth;
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 19:57 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