Recent

Author Topic: [KOL] Listbox Scrollbar  (Read 19309 times)

JoniDS

  • New Member
  • *
  • Posts: 11
[KOL] Listbox Scrollbar
« on: January 29, 2009, 11:01:02 pm »
Is it possible to "hide" listbox scrollbars or get control of their paint event?

Thanks

yuriy_sydorov

  • Full Member
  • ***
  • Posts: 158
Re: [KOL] Listbox Scrollbar
« Reply #1 on: January 30, 2009, 04:19:52 pm »
You can set Options property of listbox to hide scrollbars and enable owner drawn items.

JoniDS

  • New Member
  • *
  • Posts: 11
Re: [KOL] Listbox Scrollbar
« Reply #2 on: February 04, 2009, 01:54:08 am »
I think when you are talking about de LoNoHideScroll, right?

But wether i put yes or no, scrollbar always appears.

I've looked at source code and testing i managed to hide the scroll bar if i removed WS_VSCROLL from the newlistbox function. Of course it will now never show no matter what i put in Lonohidescroll.

Code: [Select]
function NewListbox( AParent: PControl; Options: TListOptions ): PControl;
var Flags: Integer;
begin
  Flags := MakeFlags( @Options, ListFlags );
  Result := _NewControl( AParent, 'LISTBOX', WS_VISIBLE or WS_CHILD or WS_TABSTOP
                         or WS_BORDER  or WS_VSCROLL
                         or LBS_NOTIFY  or Flags , True, @ListActions );
  with Result.fBoundsRect do
  begin
    Right := Right + 100;
    Bottom := Top + 200;
  end;
  Result.fColor := clWindow;
  Result.fLookTabKeys := [ tkTab, tkLeftRight ];
end;   

Is this because SetWindowLong doesn't allows to change WS_VSCROLL property after window has been created?

Using the following code still shows the scrollbar :
Code: [Select]
procedure TForm1.ListBox1Show(Sender: PObj);
var
 style : integer;
begin
style :=   GetWindowLong(listbox1.handle, GWL_STYLE) xor WS_VSCROLL;
SetwindowLong(Listbox1.Handle,GWL_STYLE,  style );
SetWindowPos(Listbox1.handle, Listbox1.handle,Listbox1.left, listbox1.Top, listbox1.Width, listbox1.height,SWP_NOMOVE or SWP_NOSIZE or SWP_NOZORDER or SWP_FRAMECHANGED);
end;
     
« Last Edit: February 04, 2009, 07:53:24 pm by JoniDS »

yuriy_sydorov

  • Full Member
  • ***
  • Posts: 158
Re: [KOL] Listbox Scrollbar
« Reply #3 on: February 06, 2009, 04:15:51 pm »
I misread loNoHideScroll option.

Removing WS_VSCROLL is the only way to hide scroll bar.

Use this in form's FormCreate event:
Code: [Select]
listbox1.Style:=listbox1.Style and not WS_VSCROLL;

u-boot

  • Newbie
  • Posts: 1
Re: [KOL] Listbox Scrollbar
« Reply #4 on: May 03, 2012, 01:44:39 pm »
I know this is an old topic but i think it must be updated.
Code: [Select]
listbox1.Style:=listbox1.Style and not WS_VSCROLL;
This "solution" causes following Error:
Error: Incompatible types: got "TListBoxStyle" expected "LongInt"

Definition of TListBoxStyle:
TListBoxStyle = (lbStandard, lbOwnerDrawFixed, lbOwnerDrawVariable, lbVirtual);


Mi-Ki

  • Jr. Member
  • **
  • Posts: 74
Re: [KOL] Listbox Scrollbar
« Reply #5 on: January 02, 2017, 09:09:42 am »
Hi.
How to hide scrollbar Lazarus in linux?

derek.john.evans

  • Guest
Re: [KOL] Listbox Scrollbar
« Reply #6 on: January 02, 2017, 09:49:39 am »
Often the solution is to use a different control to display a list.
Ie: TListview, tstringgrid, tsynedit, tdatagrid

Some controls are 100% native, so a solution is platform specific.

I often find bonus features if you think outside the class names
« Last Edit: January 02, 2017, 09:51:27 am by Geepster »

Mi-Ki

  • Jr. Member
  • **
  • Posts: 74
Re: [KOL] Listbox Scrollbar
« Reply #7 on: January 03, 2017, 08:18:07 am »
No other does not
« Last Edit: January 03, 2017, 09:57:35 am by Mi-Ki »

 

TinyPortal © 2005-2018