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:
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:
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.