Returns or sets a value that determines whether scroll bars in a ListBox, ComboBox, or RichEdit control are disabled (for other controls, see Remarks below).
object.DisableNoScroll [ = boolean ]
DisableNoScroll determines whether or not the scroll bars are enabled.
False = (Default) Scroll bars appear normally when displayed.
True = Scroll bars appear dimmed when displayed.
Ocx ListBox lb = "", 10, 10, 100, 100
Local n : For n = 1 To 9 : lb.AddItem "Item " & n : Next n
Ocx Command cmd = "Disable Scroll", 20, 120, 80, 22
Do : Sleep : Until Me Is Nothing
Sub cmd_Click
lb.DisableNoScroll = (cmd.Caption = "Disable Scroll")
cmd.Caption = (lb.DisableNoScroll ? "Enable Scroll" : "Disable Scroll")
If Not lb.DisableNoScroll Then Local n : For n = 1 To 9 : lb.AddItem "Item " & n : Next n
EndSub
In RichEdit the DisableNoScroll property is ignored when the ScrollBars property is set to 0 (None). However, when ScrollBars is set to 1 (Horizontal), 2 (Vertical), or 3 (Both), individual scroll bars are disabled when there are too few lines of text to scroll vertically or too few characters of text to scroll horizontally.
To reproduce this function in other objects, such as a Form, you can use the built-in EnableScrollBar() API, which has the added advantage of allowing you to disable (or enable) only part of the scroll bar if that is what you wish. An example of how to use the API is below (the constants listed are also 'built-in' and are included in this example only for illustrative purposes):
Const SB_HORZ = 0 ' horizontal scrollbar
Const SB_VERT = 1 ' vertical scrollbar
Const SB_CTL = 2 ' scollbar control
Const SB_BOTH = 3 ' both horiz & vert scrollbars
Const ESB_ENABLE_BOTH = &H0 ' enable both arrows
Const ESB_DISABLE_LTUP = &H1 ' disable left/up arrows
Const ESB_DISABLE_RTDN = &H2 ' disable right/down arrows
Const ESB_DISABLE_BOTH = &H3 ' disable both arrows
OpenW 1 : Win_1.ScrollBars = 2
~EnableScrollBar(Win_1.hWnd, SB_VERT, ESB_DISABLE_BOTH)
{Created by Sjouke Hamstra; Last updated: 17/11/2014 by James Gaite}