ChooseFont() 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 Text Style picker (Font picker) with the specified Text style selected in the dialog. You can call this function from the MapBasic window in MapInfo Pro.

Return Value

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

Syntax

ChooseFont(font_clause)

Font_clause - string. Either an MB Font style string or a Font object. If passing an empty string the Text Style dialog will open initially with the Current Font style.

Example

Passing a Brush Object as font_clause :

Dim tFont as Font
tFont= MakeFont("Arial", 1, 20,0,16777215)
Print ChooseFont(tFont )

Pass font_clause as a string:

Print ChooseFont("Font(" & """Arial""" & ",1,20,16777215)")

Pass an empty string:

Print ChooseFont("") - Returns the current default Font (e.g.: Font ("Arial",0,9,0)).

When function is called the Text Style picker will open with the Font style passed as Font_clause (e.g.: Text style set to Arial font, with bold white letters). If user just hits OK on Text style dalog, a Font clause of Font ("Arial",0,9,0) will be returned and shown in Message window. If user selects a different Font Style, Color, or Background, or effects, the new Font style clause will be returned and shown in Message window. If user hits Cancel on Font Style dialog, an empty string is returned.