Board index » delphi » Help about Listbox and Horizontal ScrollBar

Help about Listbox and Horizontal ScrollBar

Hi all,

I have the following line in my code:

SendMessage(Listbox1.Handle, LB_SETHORIZONTALEXTENT, 700, Longint(0));

How do I do to define SmallChange and LargeChange of this ScrollBar?

Any help is well coming.
Thank you, Marcos Barreto

 

Re:Help about Listbox and Horizontal ScrollBar


Quote
> I have the following line in my code:
> SendMessage(Listbox1.Handle, LB_SETHORIZONTALEXTENT, 700, Longint(0));
> How do I do to define SmallChange and LargeChange of this ScrollBar?

Marcos,

you should be able to at least define the "large change" size by setting a
"page size" using the SetScrollInfo function. The small change is up to the
controls handling of the scroll messages and i don't know of a method to
change it from outside.

  Var
    scrollinfo: TScrollInfo;

  SendMessage(Listbox1.Handle, LB_SETHORIZONTALEXTENT, 700, Longint(0));
  FillChar( scrollinfo, sizeof(scrollinfo),0);
  With scrollinfo Do begin
    cbSize := Sizeof( scrollinfo );
    fMask := SIF_PAGE;
    nPage := 200;
  End;
  SetscrollInfo( listbox1.handle, SB_HORZ, scrollinfo, true );

Peter Below (TeamB)  100113.1...@compuserve.com)

Re:Help about Listbox and Horizontal ScrollBar


Just a note - once the user uses the horizontal scrollbar, the listbox
sets it to the default parameters again. You might need to handle
WM_HSCROLL messages to reset the values.

Yorai Aminov (TeamB)
http://ourworld.compuserve.com/homepages/yaminov

Re:Help about Listbox and Horizontal ScrollBar


Do you could send me  a part of source code about use WM_HSCROLL for change
a listbox in a unit of my program. I'm beginner!
It will help very much!

Thanks, Marcos.

-----Mensagem original-----
De: Yorai Aminov (TeamB) <yami...@no.spam.trendline.co.il>
Grupos de notcias: borland.public.delphi.vcl.components.using
Data: Domingo, 21 de Junho de 1998 14:28
Assunto: Re: Help about Listbox and Horizontal ScrollBar

Quote
>Just a note - once the user uses the horizontal scrollbar, the listbox
>sets it to the default parameters again. You might need to handle
>WM_HSCROLL messages to reset the values.

>Yorai Aminov (TeamB)
>http://ourworld.compuserve.com/homepages/yami

Re:Help about Listbox and Horizontal ScrollBar


Do you could send me  a part of source code about use WM_HSCROLL for change
a listbox in a unit of my program. I'm beginner!
It will help very much!

Thanks, Marcos.

-----Mensagem original-----
De: Yorai Aminov (TeamB) <yami...@no.spam.trendline.co.il>
Grupos de notcias: borland.public.delphi.vcl.components.using
Data: Domingo, 21 de Junho de 1998 14:28
Assunto: Re: Help about Listbox and Horizontal ScrollBar

Re:Help about Listbox and Horizontal ScrollBar


On Tue, 23 Jun 1998 12:26:33 -0300, "Marcos Barreto"

Quote
<mr...@vca.provider.com.br> wrote:
>Do you could send me  a part of source code about use WM_HSCROLL for change
>a listbox in a unit of my program. I'm beginner!
>It will help very much!

You create a TListBox descendant to do this:

type
  TMyListBox = class(TListBox)
  private
    procedure WMHScroll(var Message: TMessage); message WM_HSCROLL;
  end;

...

procedure TMyListBox.WMHScroll(var Message: TMessage);
begin
  inherited;
  Do_Whatever_You_Want;
end;

Yorai Aminov (TeamB)
http://ourworld.compuserve.com/homepages/yaminov

Re:Help about Listbox and Horizontal ScrollBar


Yorai Aminov send me:

Quote
>You create a TListBox descendant to do this:
>type
>  TMyListBox = class(TListBox)
>  private
>    procedure WMHScroll(var Message: TMessage); message WM_HSCROLL;
>  end;
>...
>procedure TMyListBox.WMHScroll(var Message: TMessage);
>begin
>  inherited;
>  Do_Whatever_You_Want; { What I must make here }
>end;

and Peter Below said me:

Quote

>  Var
>    scrollinfo: TScrollInfo;

>  SendMessage(Listbox1.Handle, LB_SETHORIZONTALEXTENT, 700, Longint(0));
>  FillChar( scrollinfo, sizeof(scrollinfo),0);
>  With scrollinfo Do begin
>    cbSize := Sizeof( scrollinfo );
>    fMask := SIF_PAGE;
>   nPage := 200;
> End;
>  SetscrollInfo( listbox1.handle, SB_HORZ, scrollinfo, true )

Well, which I want it is really to define the amount that should be rolled
in the horizontal bar of a Listbox. How do I make this? How i can use the
Peter's code?

Do u could help me?

Thanks, Marcos

Other Threads