Table of Contents

 
SelectText
 

Purpose

Displays a selected box around text

 

Protoype

void CTextMngr::SelectText (bool b_select, string str_text_id = "")
 

Parameters

select whether to select a text object or unselect the current text object
text_id the ID of the text object to select
 

Description

This function is used to create a selection box around a Selection Text object. When you pass a value of TRUE for b_select along with an object ID, the function will extract the associated image ID that corresponds to the selection box and cut the image to fit the text. Here is an example selection box:

This selection box is 287x97 pixels. But what if the text that needs to be selected is smaller? As said before, the function cuts the upper and lower corners and blits them together to create a smaller selection box:

This selection box is only 120x26 pixels. This box will appear behind the text. If the image object that contains the box has a transparency key, you can have transparent selection boxes. If the text is larger than the image box, the function will not work properly. When a text object is selected, you can use GetSelectedText() to obtain the ID of the currently selected text object.

Passing a value of FALSE in for b_select and ignoring the second parameter will remove the selection box and disable the selected text. (no text object ID will be returned with GetSelectedText()).

NOTE: Currently only one Selection Text object can be selected at a time. In the future you will be able to group Selection Text ojects so that you can select one or more than one in each group.

NOTE: You do not have to call the function with FALSE before enabling another Selection Text object.

 
Use
CTextMngr text;
// enable selection
text.SelectText(TRUE, "my_text");
// disable selection
text.SelectText(FALSE);
 

Prev: RenderTexts
Next: SetFont