SampleArea()

Summary

Creates a sample area object for use in a menu or dialog box.

Syntax

sample_area = SampleArea (real line_width, linestyle line_style, color line_clr, fillstyle fill_style, color fill_clr, array options)

Argument Contents
line_width The border width in points
line_style The border style of the sample
line_clr The border color of the sample
fill_style The fill style of the sample
fill_color The fill color of the sample
Option Type Contents
Size 2 reals The width and height (in points) of a rectangle in which the sample can be displayed
Shape String The shape of the sample area: "Rect" (the default), "Rounded Rect", "Circle", "Ellipse", "Wedge", "Polygon" or "Fill"

Returns

A sample area object.

Notes

  • Sample area objects can be used to preview how area map features will look from within a menu or dialog box.

  • When the Fill option is used, the sample will extend all the way to the border, which makes it appropriate to generate a fill pattern if you save the sample to an image.

Example 1

// Define an array of sample areas filled with different gray-scale colors...
dim samples[10]
solid_line = LineStyle({{{0, -1, 0}}})
str3 = "X X X X "
str4 = " X X X X"
shaded = FillStyle({str3, str4, str3, str4, str3, str4, str3, str4})
for i = 1 to 10 do
x = 65000 / 10 * i
samples[i] = SampleArea(3, solid_line, ColorRGB(0, 0, 0), shaded, ColorRGB(x, x, x), )
end
// In some dialog box, use the array in a scrolling list...
popdown menu 12, 2, 24, 8 list: samples variable: idx

Example 2

// Create a Fill pattern and save it to sample image
map_layer_set = GetLayer() + "|"
options = {{"Shape","Fill"}} + options
{ line_width , line_style , line_color , fill_style , fill_color } = { GetLineWidth(map_layer_set) ,
GetLineStyle(map_layer_set) ,
GetLineColor(map_layer_set) ,
GetFillStyle(map_layer_set) ,
GetFillColor(map_layer_set)}
options = options + {{"Size", 64,64}}
sample= SampleArea(line_width,line_style,line_color,fill_style,fill_color,options)
fname = "c:\\foo\\sample.png"
SaveSampleToImage(sample, fname, "png", {{"Border","False"}, {"Size", 50,50}})

Error Codes

Error Type Meaning
Error One of the options is not valid

See Also

Function Summary
GetSample() Gets a sample object indicating how features in a layer or selection set display on a map
GetThemeSamples() Gets sample objects indicating how features in a theme display on a map.
SamplePoint() Creates a sample point object for use in a menu or dialog box
SampleLine() Creates a sample line object for use in a menu or dialog box
SampleText() Creates a sample text object for use in a menu or dialog box
SaveSampleToImage() Saves a sample object to an image file
SetSampleText() Creates a sample object based on an input sample with the specified text for use in a menu or dialog box