Navigation: ABC Library Reference > ASCIIFileClass > AsciiFileClass Methods >====== SetPercentile (set file to relative position) ====== | |
SetPercentile( percentile )
SetPercentile | Positions the file to the record nearest to: |
File size * percentile / 100. | |
percentile | A value between 0 and 100 that indicates a relative position within the file. This value may be set by a vertical scrollbar thumb position. |
The SetPercentile method positions the file to the record nearest to file size * percentile / 100. You may use SetPercentile to position the file based on the end user's vertical scrollbar thumb setting.
Implementation:
The SetPercentile method positions the file based on a given percentage (usually determined by the vertical thumb position). SetPercentile extends the index as required and calls the virtual SetLine method to postion the file.
SetPercentile calculates the position by dividing percentile by 100 then multiplying the resulting percentage times the file size.
Example:
MyViewerClass.TakeDrag PROCEDURE(UNSIGNED EventNo)
CODE
IF FIELD()=SELF.ListBox
IF EventNo = EVENT:ScrollDrag
SELF.SetPercentile(SELF.ListBox{PROP:VScrollPos}) !reposition based on thumb
END
END
See Also: SetLine