PDA

View Full Version : Richtext and labels


grim86
08-22-2008, 08:21 AM
I have some Labels and a empty Richtext, I would like to do this:
-When I click on the Label in the Richtext box has to appear a document
-if I click another Label in the Richtext box has to appear a different document

I believe that this can be done with this command:

RichText.LoadFromFile("RichText1", "AutoPlay\\Docs\\Mydocument.rtf");

but when I click on the Label nothing apperas in the richtext box :huh

how can I do?

Sorry for my English

holtgrewe
08-22-2008, 08:34 AM
It's difficult to say what's wrong without an example of the code or ap, and where the actual .rtf file is located. Try placing an error test after the load, maybe that will help in the debugging...

error = Application.GetLastError();
if (error ~= 0) then
Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
end

grim86
08-22-2008, 08:57 AM
thanks for reply..finally I have done it

RichText.LoadFromFile("RichText1", "AutoPlay\\Docs\\Mydocument.rtf");
result = Application.GetLastError();

now I have another problem...
Can I change the color of the text in white and also make it a little bigger?

holtgrewe
08-22-2008, 09:46 AM
Yeah,
Use RichText.SetSelection("ObjectName", 1, -1) -- this will select the entire text, or you can select whatever portion of the text you desire.

Then use RichText.SetSelectionFormat("ObjectName", TableOfFormats, true)

Experiment with these - they should work for you. Use the help file for the exact naming conventions of the formats used.

good luck.