Autohidescroll sChecklistBos

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #58742
    Support
    Keymaster

      If you need to use a horz scrollbar then try this code:

      Code:
      procedure HorScrollBar(ListBox: TListBox);
      var
      i, w: Integer;
      maxwidth: Integer;
      begin
      maxwidth := 0;
      // Get largest item
      for i := 0 to ListBox.Items.Count – 1 do
      with ListBox do begin
      w := Canvas.TextWidth(Items);
      if w > maxwidth then
      maxwidth := w;
      end;

      SendMessage(ListBox.Handle, LB_SETHORIZONTALEXTENT, maxwidth + GetSystemMetrics(SM_CXFRAME), 0);
      SetWindowLong(ListBox.Handle, GWL_STYLE, GetWindowLong(ListBox.Handle, GWL_STYLE) or WS_HSCROLL);
      SetWindowPos(ListBox.Handle, 0, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE or SWP_NOACTIVATE or SWP_NOZORDER or SWP_NOCOPYBITS or SWP_NOSENDCHANGING or SWP_NOREPOSITION or SWP_FRAMECHANGED);
      end;

      I found it in the Net for standard ListBox, bot TsCheckListBox should work with this code too.

      #58746
      roadrunner
      Participant

        Hey,

        thanks for the example.

        Yes it works (i have a made similar one).

        But i thought that the property AutoHideScroll should do that for me.

      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.