Board index » delphi » hmmm listbox horizontal scroll bar

hmmm listbox horizontal scroll bar

is there a way to put a horizontal scroll bar on a ListBox
 

Re:hmmm listbox horizontal scroll bar


In article <3665FC94.A8888...@eoe-magical.org>, dr...@eoe-magical.org

Quote
(Donald P. Dahlman) wrote:
> is there a way to put a horizontal scroll bar on a ListBox

This unit does both tabs and a scroll bar.  If you only need the scrollbar,
just send the LB_SETHORIZONTALEXTENT message.

Angus

unit ListboxT;

interface

Uses Forms, Controls, StdCtrls;

Type
  TListBoxTabs = Class (TListBox)
    public
      procedure CreateParams (var Params: TCreateParams); override;
      Procedure SetTabStops (Val: Array of Cardinal);
      Procedure SetHorizScroll (Val: Cardinal);
      { Remember - tabstops and scroll width are in dialog units, which is  
        approx 1/4 the width of an average character }
    end;

Procedure Register;

implementation

Uses
  {$IFDEF Win32}
  Windows,
  {$ELSE}
  WinTypes, WinProcs,
  {$ENDIF}
  Classes, Messages;

procedure TListBoxTabs.CreateParams (var Params: TCreateParams);
begin
  inherited CreateParams (Params);
  with Params do
    Style := Style or lbs_UseTabStops;
end;

procedure TListBoxTabs.SetTabStops (Val: Array of Cardinal);   // dialogue
units
begin
  SendMessage (Handle, lb_SetTabStops, High (Val) - Low (Val) + 1,
                                                        LongInt (@Val));
end;

procedure TListBoxTabs.SetHorizScroll (Val: Cardinal);     // pixels
begin
  SendMessage (Handle, LB_SETHORIZONTALEXTENT,Val,LongInt(0));
end;

Procedure Register;
begin
  RegisterComponents ('Samples', [TListboxTabs]);
  end;

end.

Other Threads