Surpressing Horiz Scroll Bar

Windows specific forum
PB&J Lover
Enthusiast
Enthusiast
Posts: 212
Joined: Fri Apr 22, 2005 2:07 pm
Location: U.S.A.
Contact:

Surpressing Horiz Scroll Bar

Post by PB&J Lover »

Is there a way to supress the horizontal scroll bars for a ListIconGadget?
When my list gets too long they both appear when only one is needed.

Thanks. Viva La PB!
-- DB

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage — to move in the opposite direction.

Albert Einstein
Sub-Routine
User
User
Posts: 82
Joined: Tue May 03, 2005 2:51 am
Location: Wheeling, Illinois, USA
Contact:

Post by Sub-Routine »

I KNOW! I KNOW!
I went through this not long ago.

What happens is when the vertical scroll is added is uses some pixels (about 12) of your ListIconGadget. So if your columns already fill the LIG you need a horizontal scroll.

If you make the ListIconGadget a bit wider (to allow for the vertical scrollbar) you won't get the horizontal scroll bar.

Rand
johnnyutah
User
User
Posts: 27
Joined: Sat Oct 16, 2004 1:25 pm

Post by johnnyutah »

This is the code I use:

Code: Select all

If CountGadgetItems(#ListIconGadget) > 17
; Resize columns to make them smaller so more space for vertical scrollbar.
  SendMessage_(GadgetID(#ListIconGadget), #LVM_SETCOLUMNWIDTH, 0, 90)
  SendMessage_(GadgetID(#ListIconGadget), #LVM_SETCOLUMNWIDTH, 1, 90)
Else
; Column size if scrollbar is not displaying
  SendMessage_(GadgetID(#ListIconGadget), #LVM_SETCOLUMNWIDTH, 0, 98)
  SendMessage_(GadgetID(#ListIconGadget), #LVM_SETCOLUMNWIDTH, 1, 98)
EndIf
You need to work out how many items the listicongadget can display before it shows the vertical scrollbar. In the example above its 17.
akj
Enthusiast
Enthusiast
Posts: 668
Joined: Mon Jun 09, 2003 10:08 pm
Location: Nottingham

Post by akj »

Here is my preferred method for avoiding a horizontal scroll bar.

Immediately after adding or deleting a row (and possibly also immediately creating the gadget) include the line:

Code: Select all

SendMessage_(GadgetID(#ListIconGadget), #LVM_SETCOLUMNWIDTH, last_column_number, #LVSCW_AUTOSIZE_USEHEADER)
This gets Windows to automatically adjust the width of the last column so that the columns fit within the gadget.
Anthony Jordan
Post Reply