ChoosePen() function - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Brings up Line Style picker (Pen picker) with the specified style selected in the dialog. You can call this function from the MapBasic window in MapInfo Pro.

Return Value

String: A MapBasic Pen clause string of the Line style the user selected. If user cancels the dialog, an empty string is returned.

Syntax

ChoosePen(pen_clause)

pen_clause is either an MB pen style string or a Pen object. If passing an empty string the Line Style dialog will open initially with the Current Pen style.

Description

This function displays the Choose Projection dialog box and returns the selected coordinate system as a string. The returned string is in the same format as the CoordSys clause. Use this function if you wish to allow the user to set a projection within your application.

Example

Passing a Pen Object as pen_clause :
Dim tPen as Pen
tPen = MakePen(3, 9, 16711680)
Print ChoosePen(tPen)
Pass pen_clause as a string:
Print ChoosePen("Pen(3, 9, 16711680)")
Pass an empty string:
Print ChoosePen("") - Returns the current default Pen which is typically a thin black 1 pixel line (e.g.: Pen (1,2,0) ).

When function is called the Line Style picker will open with the Pen style passed as pen_clause (For example, a 3 pixel red dashed line as initial style). If user just hits OK on Line style dalog, a Pen clause of Pen (3,9,16711680) will be returned and shown in Message window. If user selects a different Line Style, Color, or Width, the new Pen style clause will be returned and shown in Message window. If user hits Cancel on Line Style dialog, an empty string is returned.