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