Help home › The Family Historian API › Function Index › fhPromptUserForRichText

functions

fhPromptUserForRichText

Description

Displays a dialog to allow a user to enter or edit rich text.

There is no need to call fhUpdateDisplay before calling this function, as there would be if you were using an IUP function to display a dialog box.

Minimum FH Version

7

Syntax

rtResult = fhPromptUserForRichText([rt[, hParentWnd]])

Parameters

rt
Rich Text Object (optional): The initial value to display in the dialog.
hParentWnd
Optional parent window handle ('light userdata').  If you are calling the function from a dialog box, such as an IUP dialog box, you must pass in the window handle of the dialog box - see second example below.

Return Value

rResult
The rich text entered (or edited); or nil if the user cancelled.

Examples

local rt = fhPromptUserForRichText();
if rt == nil then
    fhMessageBox("User cancelled");
else
    fhDisplayRichTextBox(rt);
end
                    
require("iuplua");
iup.SetGlobal("CUSTOMQUITMESSAGE","YES");
 
local btn = iup.button{title="click me"};
local dlg=iup.dialog{ iup.vbox{ iup.label{title="Hello"}, btn}, title="Test Click", size="200x200"};
iup.SetAttribute(dlg, "NATIVEPARENT", fhGetContextInfo("CI_PARENT_HWND"));
 
function btn:action() 
	local rt = fhPromptUserForRichText(nil, dlg.HWND);
 
	if rt == nil then
		fhMessageBox("User cancelled");
	else
		fhDisplayRichTextBox(rt, dlg.HWND);
	end
end
 
	iup.Popup(dlg);
	iup.Destroy(dlg); 

Links to

Linked from