View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0005395 | JEDI VCL | 00 JVCL Components | public | 2010-11-09 00:20 | 2012-02-29 16:53 |
| Reporter | masonwheeler | Assigned To | obones | ||
| Priority | normal | Severity | tweak | Reproducibility | N/A |
| Status | resolved | Resolution | fixed | ||
| Product Version | |||||
| Target Version | Fixed in Version | 3.45 | |||
| Summary | 0005395: Exposing conversion routines in TJvxSlider | ||||
| Description | Something I ran into recently. I had a TjvxSlider with several marks on it, representing a range of percentages. In order to keep track of where 100 and other values are, I used a handful of TLabels. They're easy enough to position correctly in the form designer, but if the form gets resized, I need a way to keep the labels lined up with the marks they correspond to. I was able to add an OnResize event, but it was difficult calculating the right positions. I figured there had to be a way to calculate the position of a mark, since the control knows where to put them, so I looked and found the GetOffsetByValue method. Unfortunately, it and its reciprocal, GetValueByOffset, aren't public. Moving them to the public section solved my problems easily. Since this is a simple calculation that doesn't change any internal state, there's no risk involved in exposing these methods. Submitting my changes as per the MPL. | ||||
| Tags | No tags attached. | ||||
|
2010-11-09 00:20
|
jvxSlider.diff (1,114 bytes)
Index: JvxSlider.pas
===================================================================
--- JvxSlider.pas (revision 124)
+++ JvxSlider.pas (working copy)
@@ -109,8 +109,6 @@
procedure InternalDrawPoints(ACanvas: TCanvas; PointsStep, PointsHeight,
ExtremePointsHeight: Longint);
procedure DrawThumb(Canvas: TCanvas; Origin: TPoint; Highlight: Boolean);
- function GetValueByOffset(Offset: Integer): Longint;
- function GetOffsetByValue(Value: Longint): Integer;
function GetRulerLength: Integer;
procedure WMPaint(var Msg: TWMPaint); message WM_PAINT;
procedure WMSetCursor(var Msg: TWMSetCursor); message WM_SETCURSOR;
@@ -171,6 +169,8 @@
destructor Destroy; override;
procedure DefaultDrawPoints(PointsStep, PointsHeight,
ExtremePointsHeight: Longint); virtual;
+ function GetValueByOffset(Offset: Integer): Longint;
+ function GetOffsetByValue(Value: Longint): Integer;
property Canvas;
property RulerLength: Integer read GetRulerLength;
property Increment: Longint read FIncrement write SetIncrement default 10;
|
|
|
Thanks, this is now in SVN |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2010-11-09 00:20 | masonwheeler | New Issue | |
| 2010-11-09 00:20 | masonwheeler | File Added: jvxSlider.diff | |
| 2010-11-09 14:29 | obones | Note Added: 0018043 | |
| 2010-11-09 14:29 | obones | Status | new => resolved |
| 2010-11-09 14:29 | obones | Fixed in Version | => Daily / SVN |
| 2010-11-09 14:29 | obones | Resolution | open => fixed |
| 2010-11-09 14:29 | obones | Assigned To | => obones |
| 2012-02-29 16:53 | obones | Fixed in Version | Daily / SVN => 3.45 |