Autor Beitrag
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Di 27.04.04 21:03 
Hi,
beim Versuch eine Delphi6-Anwendung unter Delphi 5 zu compilen gab's eine böse Überraschung (welch Wunder...). Leider gibt es unter Delphi5 keinen Support für "Scrollende Listboxes". Ab D6 gibts die Eigenschaft ScrollWidth. Wie kann ich meine Listbox unter Delphi 5 scrollen (möglichst ohne TScrollBox).

Danke,
maxk

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
Loryn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34

Win 98, ME
D4 Stand.
BeitragVerfasst: Di 27.04.04 21:40 
Hi,

ich programmiere mit Delphi4 und habe es so gelöst:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
interface

type TScrollListBox = class(TListBox)
  private
    FSaveHorzScrollRange: Integer;
    function GetHorzScrollRange: Integer;
    procedure SetHorzScrollRange(Value: Integer);
  protected
    procedure CreateWnd; override;
    procedure DestroyWnd; override;
  published
    property HorzScrollRange: Integer  // horizontaler Scroll in Pixeln
      read GetHorzScrollRange write SetHorzScrollRange;
end;

implementation

procedure TScrollListBox.CreateWnd;
begin
  inherited CreateWnd;
  // gepufferte Werte wieder herstellen
  if FSaveHorzScrollRange > 0
  then begin
    HorzScrollRange := FSaveHorzScrollRange;
    FSaveHorzScrollRange := 0;
  end;
end;

procedure TScrollListBox.DestroyWnd;
begin
  // von Windows gespeicherte Werte puffern
  FSaveHorzScrollRange := HorzScrollRange;
  inherited DestroyWnd;
end;

function TScrollListBox.GetHorzScrollRange: Integer;
//       liefert Property HorzScrollRange
begin
  Result := SendMessage(Handle, LB_GETHORIZONTALEXTENT, 0, 0);
end;

procedure TScrollListBox.SetHorzScrollRange(Value: Integer);
//        setzt Property HorzScrollRange
begin
  if Value <> GetHorzScrollRange
  then SendMessage(Handle, LB_SETHORIZONTALEXTENT, Value, 0);
end;


Gruß Loryn
maxk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Mi 28.04.04 11:27 
Ich habe gerade folgenden Code gefunden:SendMessage(ListBox1.Handle, LB_SETHORIZONTALEXTENT, 5000, 0);Das ist natürlich genau das selbe - aber kürzer :mrgreen:

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.