Autor Beitrag
Spatz
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57

WIN 2k
D7E
BeitragVerfasst: Do 14.04.05 10:50 
Hallo

Ich bin eben am Schreiben einer eigenen Listboxkomponente. Ich möchte eine Property erstellen, in der man einstellen kann, welche Scrollbars ersichtlich sein sollen.

Erstelle ich die Scrollbars so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
  
  if (VAL <> FScrollBars) and HasParent then
  begin
    FScrollBars := VAL;

    if (VAL = ssBoth) or (VAL = ssVertical) then
      ShowScrollBar(Handle, SB_VERT, true);
    if (VAL = ssBoth) or (VAL = ssHorizontal) then
      ShowScrollBar(Handle, SB_HORZ, true);
  end;


funktioniert auch alles gut; es erstellt die Scrollbars. Jetzt möchte ich aber gerne, dass die Scrollbars nur angezeigt werden, wenn sie auch wirklich gebraucht werden.
Daher schreibe ich den ganzen Code in die überschriebene CreateParams- Methode. Dies endet jedoch in einer Endlosschlaufe, da jedes Mal, wenn ich die Scrollbar erstelle, das Fenster wieder einen Refresh startet.

Nun zu meinem Lösungsansatz:
Ich benutze die Params (TCreateParams) die ich bei der CreateParams- Methode übergeben bekomme und füge folgendes hinzu:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
    if (VAL = ssBoth) or (VAL = ssVertical) then
      Params.Style := Params.Style or WS_VSCROLL;
    if (VAL = ssBoth) or (VAL = ssHorizontal) then
      Params.Style := Params.Style or WS_HSCROLL;


Jedoch gibt das bei mir kein Ergebnis...
Ich sehe nicht wieso es bei dem vertikalen Scrollbar funktioniert (Standard), beim horizontalen aber nicht.


Besten Dank

_________________
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.