User Tools

Site Tools


setpercentile_set_file_to_relative_position_.htm
Navigation:  ABC Library Reference > ASCIIFileClass > AsciiFileClass Methods >====== SetPercentile (set file to relative position) C6H0009.jpg ====== Previous pageReturn to chapter overviewNext page

SetPercentile( percentile )

blk2blue.jpg

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

setpercentile_set_file_to_relative_position_.htm.txt · Last modified: 2021/04/15 15:57 (external edit)