I've always written code to set the hints when they are sufficiently
long that they need to be split, for example:
Image1.Hint:='This is line 1 of the hint'+#13+' and this is line 2';
It can be done in FormCreate, and I don't think there is any significant
performance disadvantage compared with using the property editor
This way you can also have a dynamically created hint that is context
sensitive, depending on (for example) the mouse position.
Brendan Blake.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of CubicDesign
Sent: 27 June 2007 18:32
To: [email protected]
Subject: Help needed with RegisterPropertyEditor
Hi.
Doesn't look stupid when you see a hint window spreading on the whole
screen's width?
I tried long time ago to do a hint (tool tip) window that is able to
display the text on more than one single line. I never found a solution
so I quit.
Today I accidentally found few words in an incomplete article that gave
me an idea:
instead of replacing the THintWindow component, I should split
(manually) my hints on multiple lines using the #13 character.
Because the property editor does not allow entering that character, I
need a new property editor and I designed one. But it doesn't work very
well.
The problem is that it replaces ALL properties of a control that are of
'string' type (and not only the Hint property)
For example if I set in this new property editor the string 'This is a
hint' for the Hint property of a TButton, then the string will be also
assigned to the 'HelpKeyword' property.
I think the problem is in the Register procedure.
procedure Register;
RegisterPropertyEditor (TypeInfo(string), nil, 'HINT',
THintPropertyEditor); // <------ the 'HINT' won't do its job
____________________________________________
unit HintPropertyEditor;
interface
TYPE
THintPropertyEditor = class(TPropertyEditor)
private
protected
public
HintForm: THntEditor;
function GetAttributes: TPropertyAttributes; override;
procedure Edit; override;
function GetValue: String; override;
published
end;
procedure Register;
implementation
function THintPropertyEditor.GetAttributes: TPropertyAttributes;
begin
result:= [paDialog];
end;
procedure THintPropertyEditor.Edit;
begin
HintForm:= THntEditor.Create(nil);
if Hintform.Showmodal = mrOK
then TControl(GetComponent(0)).Hint:= HintForm.Memo.Text {Lines};
//Modified; ???
HintForm.Free;
end;
function THintPropertyEditor.GetValue: String;
begin
result:= TControl(GetComponent(0)).Hint;
end;
procedure Register;
begin
RegisterPropertyEditor(TypeInfo(string), nil, 'HINT',
THintPropertyEditor);
end;
_______________________________
The THntEditor goes like this:
unit HintEditorForm;
interface
uses
Messages, SysUtils, Variants, Classes, Graphics, Forms
type
THntEditor = class(TForm)
Memo: TMemo;
btnOK: TButton;
btnCancel: TButton;
private
public
end;
implementation {$R *.dfm}
procedure Register;
begin
RegisterComponents('HintEditor', [HntEditor]);
end;
end.
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi