SclRangeGet
Overview
Get the specified item from a range object that has been created using the SclRangeExpand command.
Synopsis
SclRangeGet $RangeHandle $Item Value
Description
The value of the range at the Item position is returned from the specified range object.
Arguments
- RangeHandle
- Item
- Value
Passed by value. The handle to the Scl range object that has been previously created by the SclRangeExpand command.
Passed by value. The position in the range from which the value is required. Note that 0 is the first position, 1 is the second position and so on. If Item is < 0 or >= the number of items in the range SclRangeGet returns an error condition.
Passed by reference. The value of the range at the Item position is returned.
Examples
set status [SclRangeExpand handle "1,10,1"]
if {$handle == SCL_UNDEFINED_HANDLE} {
puts "Undefined range handle"
} else {
# Loop through the range
set count [ SclRangeGetCount $handle ]
for { set i 0 } { $i < $count } { incr i } {
set status [ SclRangeGet $handle $i value ]
if {$status == $SCL_OK} {
# Do some processing with $value
} else {
puts "Error getting range value"
break
}
}
# destroy the range object by destroying the handle variable
SclDestroy handle
}
|