|
of_setposition
|
|
Full name
|
pfc_u_progressbar.of_setposition
|
Access
|
public
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
public function integer of_setposition(integer)
|
Name
|
Datatype
|
ldc_completion
|
decimal
|
li_rc
|
integer
|
public function integer of_setposition (integer ai_position);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_SetPosition
//
// Access: public
//
// Arguments:
// ai_position the position the progress bar
//
// Returns: integer
// SUCCESS = the current position of the progress bar
// ERROR = -1
//
// Description:
// Sets the current position of the progress bar
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 6.0 Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1996-1997 Sybase, Inc. and its subsidiaries. All rights reserved.
// Any distribution of the PowerBuilder Foundation Classes (PFC)
// source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////
decimal ldc_completion
integer li_rc
if isnull(ai_position) then
return -1
end if
// If this is less than the minimum, the current position is set to the minimum
if ai_position < ii_minimum then
ai_position = ii_minimum
end if
// If this is greater than the maximum, the current position is set to the maximum
if ai_position > ii_maximum then
ai_position = ii_maximum
end if
ii_position = ai_position
dw_progress.setredraw(false)
// if maximum value is zero we are completed (prevents divide by zero)
// or if completion result will be greater than 1 then make it 1
// otherwise find our completion percentage
if (ii_maximum = 0) or (ii_position > ii_maximum) then
ldc_completion = 1
else
// turn on the progress rectangle and percentage text if style uses it
dw_progress.object.pct.visible = 1
dw_progress.object.progress_rect.visible = 1
ldc_completion = ii_position / ii_maximum
ii_percentcomplete = ldc_completion * 100
end if
li_rc = of_updatevisuals(ldc_completion)
dw_progress.setredraw(true)
// turn off progressbar after it reaches 100%
if ldc_completion >= 1 and ib_autoreset then
this.post function of_reset()
end if
if li_rc < 0 then
return li_rc
else
return ii_position
end if
end function