Repository navigation
tkHScrollBar
Home › All Categories › tkControls › tkHScrollBar
Draws a horizontal scrollbar that you size, feed a range, and listen to.
tkHScrollBar is a flat horizontal track with a flat thumb and no arrow buttons. You tell it the total, the page and the position; it tells you when the user drags, pages or wheels it. It does not scroll anything itself, so use it under content you already draw that is wider than its view: a timeline, a wide table, a long line of text.
It is a thin module over tkScrollBar, which describes the behaviour both bars share: paging and auto-repeat, the minimum thumb, the wheel, theme colours and the porting notes. It takes only the horizontal wheel, and a positive wheel delta moves it right.
#import "vendor/tkControls/tkHScrollBar"
using tkHScrollBar
using tkHostThe module imports tkScrollBar, tkHost and tkTheme publicly.
dim shared as TK_WIDGET ptr gHS
sub HS_Scroll( byval hSB as TK_WIDGET ptr, byval newPos as integer )
gLeftColumn = newPos ' the user moved the bar: redraw the content from here
tkHost_Invalidate( gHost )
end sub
gHS = tkHScrollBar_Create( tkHost_Root( gHost ), 1003 )
tkWidget_SetPos( gHS, 0, ph - tkHost_Scale( gHost, TKHSCROLL_DEFAULT_HEIGHT ), _
pw, tkHost_Scale( gHost, TKHSCROLL_DEFAULT_HEIGHT ) )
tkHScrollBar_SetRange( gHS, nColumns, nVisibleColumns, 0 )
tkHScrollBar_SetScrollCallback( gHS, @HS_Scroll )tkHScrollBar_SetRange and tkHScrollBar_SetPos are silent; only the user's actions call the
scroll callback. Forward a horizontal wheel from your content with
tkHScrollBar_HandleWheelDelta( gHS, cint( m->wheelX * 120 ) ).
PsHScrollBar_* → tkHScrollBar_* and CHSCROLL_* → TKHSCROLL_*; the callback type names are
unchanged and the handle is TK_WIDGET ptr. tkHScrollBar_GetThumbRect is new on this bar. The
rest of the differences are listed on tkScrollBar.
PsHScrollBar remains the behaviour reference.
Every public name the module declares, as the source declares it. Signatures are exact; type bodies keep their field comments and drop the rest.
const TKHSCROLL_REPEAT_DELAY = TKSCROLL_REPEAT_DELAY
const TKHSCROLL_REPEAT_MS = TKSCROLL_REPEAT_MS
const TKHSCROLL_MIN_THUMB = TKSCROLL_MIN_THUMB
const TKHSCROLL_DEFAULT_HEIGHT = TKSCROLL_DEFAULT_THICKNESStype TKHSCROLLBAR_PAINTINFO as TKSCROLLBAR_PAINTINFO
type HScrollPaintCallbackSub as tkScrollPaintSub
type HScrollCallbackSub as tkScrollNotifySubfunction tkHScrollBar_Create( byval hParent as TK_WIDGET ptr, byval CtrlID as integer ) as TK_WIDGET ptr
sub tkHScrollBar_SetRange( byval hSB as TK_WIDGET ptr, byval nTotal as integer, byval nPage as integer, byval nPosition as integer )
function tkHScrollBar_GetPos( byval hSB as TK_WIDGET ptr ) as integer
sub tkHScrollBar_SetPos( byval hSB as TK_WIDGET ptr, byval nPosition as integer )
function tkHScrollBar_HandleWheelDelta( byval hSB as TK_WIDGET ptr, byval nDelta as integer ) as boolean
sub tkHScrollBar_SetWheelStep( byval hSB as TK_WIDGET ptr, byval nUnitsPerNotch as integer )
function tkHScrollBar_GetWheelStep( byval hSB as TK_WIDGET ptr ) as integer
function tkHScrollBar_NeedsThumb( byval hSB as TK_WIDGET ptr ) as boolean
function tkHScrollBar_IsDragging( byval hSB as TK_WIDGET ptr ) as boolean
function tkHScrollBar_GetThumbRect( byval hSB as TK_WIDGET ptr ) as TKRECT
sub tkHScrollBar_SetColors( byval hSB as TK_WIDGET ptr, byval backclr as ulong, byval foreclr as ulong, byval foreclrhot as ulong )
sub tkHScrollBar_ApplyTheme( byval hSB as TK_WIDGET ptr, byref t as TKTHEME_COLORS )
sub tkHScrollBar_UnpinColors( byval hSB as TK_WIDGET ptr )
sub tkHScrollBar_SetPaintCallback( byval hSB as TK_WIDGET ptr, byval usersub as HScrollPaintCallbackSub )
sub tkHScrollBar_SetScrollCallback( byval hSB as TK_WIDGET ptr, byval usersub as HScrollCallbackSub )- tkControls
- tkApp, tkHost
- PsHScrollBar, the PsControls control
tiko-lang · Home · Feature Index · Keyword Index · License
FreeBASIC manual pages reproduced under the GNU FDL 1.3.
- Generics
- Interfaces
- For Each
- Iterators
- Tuples
- Array Results
- Defer
- Lambdas
- Block Strings
- Partial Types
- String Slices
- Embed
- Typed Variadics
- C Header Import
- Foreign Library Linking
- UString
- Fixed-Width Types
- Nullptr
- String Library
- Format
- Array
- Map
- Set
- LinkedList
- OrderedMap
- OrderedSet
- Sorting
- Optional
- Result
- Smart Pointers
- Date and Time (Chrono)
- Filesystem
- File Streams
- Config (INI and TOML)
- Codec
- Hash
- UUID
- OS
- Process
- Net
- HTTP and TLS
- Math Library
- Finance
- Logging
- Terminal TUI Library
- PsControls
- tkControls
- sys/win
- Goroutines and Channels
- LLVM Backend
- tiko build
- TIKO_COMPILER
- Variable Declarations
- Standard Data Types
- User Defined Types
- Procedures
- Operators
- Control Flow Statements
- Converting Data Types
- Array Functions
- String Functions
- Mathematical Functions
- Bit Manipulation
- Date and Time Functions
- File I/O Functions
- Console Functions
- User Input (Runtime Library)
- User Input Functions (Graphics Library)
- Screen Functions
- 2D Drawing Functions
- Graphics Library Reference
- Graphics Keyword List
- Memory Functions
- Threading Support Functions
- Error Handling Functions
- Operating System Functions
- Preprocessor
- Intrinsic Defines
- Miscellaneous Keywords
- Modularizing