TrackBar control
Overview
Modern Windows applications use cute TrackBar control, below is a screenshot from “Photos” application:
I decided to mimic this control in Clarion.
Features
The control supports both horizontal and vertical orientations, each orientation supports top/left, center and bottom/right alignments.
Demo app
The code is quite primitive:
PROGRAM
INCLUDE('trackbar.inc'), ONCE
MAP
INCLUDE('printf.inc'), ONCE
END
Window WINDOW('Trackbar demo'),AT(,,260,100),CENTER,GRAY,SYSTEM,FONT('Segoe UI',9)
REGION,AT(16,26,186,22),USE(?rgnQuality)
PROMPT('Prompt1'),AT(16,14),USE(?lblQuality)
BUTTON('Close'),AT(197,76,47),USE(?btnClose),STD(STD:Close)
END
tbQuality CLASS(TTrackBar)
OnNewSelection PROCEDURE(LONG pValue), DERIVED, PROTECTED
END
CODE
OPEN(Window)
tbQuality.Init(?rgnQuality)
tbQuality.SetRange(10, 100)
tbQuality.SetValue(50)
ACCEPT
END
tbQuality.OnNewSelection PROCEDURE(LONG pValue)
sQuality STRING(6), AUTO
CODE
IF pValue < 50
sQuality = 'Low'
ELSIF pValue < 80
sQuality = 'Medium'
ELSE
sQuality = 'High'
END
?lblQuality{PROP:Text} = printf('Quality: %i%% (%s)', pValue, sQuality)
Requirements
- Clarion versions: C6.3 and higher.
- Template chains: ABC, Clarion.
- Multi dll apps supported.