966
asked on
hint
can someone give me some working examples of how the hint works please delphi 6,7.
for each form, panel, control, etc... where you want a Hint buble to show up when leaving the mouse over it a few seconds, you have to do 2 things :
set the Hint property with the text you want
set the ShowHint property to true.
for the ShowHint property, it's possible to only set the ShowHint of the form, and by default all components you place on it have the ParentShowHint set to true, which means that their own ShowHint will take the value of the parent (ie the form). Much like the Font & ParentFont property
set the Hint property with the text you want
set the ShowHint property to true.
for the ShowHint property, it's possible to only set the ShowHint of the form, and by default all components you place on it have the ParentShowHint set to true, which means that their own ShowHint will take the value of the parent (ie the form). Much like the Font & ParentFont property
ASKER
Thanks , can i change the colour and font of the hint box ?
ASKER
If i use flat hint, how would i add code to show a hint instead.
procedure TForm1.FlatHint1ShowHint(v ar HintStr: String;
var CanShow: Boolean; var HintInfo: THintInfo);
begin
end;
procedure TForm1.FlatHint1ShowHint(v
var CanShow: Boolean; var HintInfo: THintInfo);
begin
end;
ASKER
when i set it up as follows, ias soon as i "hover" over label 1, it displays the hint using my flat component. Im aware youdont have the component, but there are no options on this, the component just dispays a cool arror next to it. However, when i gover off from the label and back onto it again, it gives an error
" flathint1 is already used"
what code can i add to fix this, ive tried to free it, but nothing.
procedure TForm1.FlatHint1ShowHint(v ar HintStr: String;
var CanShow: Boolean; var HintInfo: THintInfo);
begin
flathint1.Create(label1);
end;
" flathint1 is already used"
what code can i add to fix this, ive tried to free it, but nothing.
procedure TForm1.FlatHint1ShowHint(v
var CanShow: Boolean; var HintInfo: THintInfo);
begin
flathint1.Create(label1);
end;
ASKER
yes after i cancel the error box it works fine .. :(
To change the hint color, you can use SetSysColors (and GetSysColor to get the current values) with COLOR_INFOBK
http://www.delphi-zone.com/2010/02/how-to-get-set-system-colors/
MSDN Ref :
http://msdn.microsoft.com/en-us/library/ms724940%28VS.85%29.aspx
http://msdn.microsoft.com/en-us/library/ms724371%28VS.85%29.aspx
http://www.delphi-zone.com/2010/02/how-to-get-set-system-colors/
MSDN Ref :
http://msdn.microsoft.com/en-us/library/ms724940%28VS.85%29.aspx
http://msdn.microsoft.com/en-us/library/ms724371%28VS.85%29.aspx
procedure SetupHintColor(C:TColor);
Const
Element: TColor = COLOR_INFOBK;
begin
SetSysColors(1, Element, C);
end;
ASKER
doesnt matter about flat hint, stay with the standard one i think. So again, how would i change background from grey ?
ASKER
ah cool, i just typed that withought rfreshing, ill check it out now
ASKER
So if i wanted background colour blue and text colour red, how would the code be?
ok, what I told you before would change the Hint back Color for all application for this windows session.
here is how with Delphi you can change only your application Hint properties :
here is how with Delphi you can change only your application Hint properties :
Application.hintpause:=20000; //set how long hint showed Application.hinthidepause:=0; //delay time before hint is hidden
Application.hintcolor:=clBlue; //hint back color Screen.hintfont.name:='times new roman'; //hint font type Screen.hintfont.color:=clRed; //hint font color
Screen.hintfont.style:=[fsbold,fsitalic]; //hint style
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
great!
ASKER
procedure SetupHintColor(C:TColor);
begin
Application.hintpause:=200 00; //set how long hint showed
Application.hinthidepause: =0; //delay time before hint is hidden
Application.hintcolor:=clB lue; //hint back color
Screen.hintfont.name:='tim es new roman'; //hint font type
Screen.hintfont.color:=clR ed; //hint font color
Screen.hintfont.style:=[fs bold,fsita lic]; //hint style
end;
? like this?
begin
Application.hintpause:=200
Application.hinthidepause:
Application.hintcolor:=clB
Screen.hintfont.name:='tim
Screen.hintfont.color:=clR
Screen.hintfont.style:=[fs
end;
? like this?
ASKER
not sure how to set it out mate, the above i posted is wrong i just relised.
:-))) ???
Anyway,if you can get TMS components it has a nice message box that works
perfect for hints and is highly configurable....
Anyway,if you can get TMS components it has a nice message box that works
perfect for hints and is highly configurable....
You don't use the C parameter of your function. I only provided all the things you could change about your Hint visual aspect and behaviour. just add these lines (not even all, only the one you need to change) and call this procedure in your application main form creation
procedure SetupHintColor;
begin
Application.hintpause:=20000; //set how long hint showed
Application.hinthidepause:=0; //delay time before hint is hidden
Application.hintcolor:=clBlue; //hint back color
Screen.hintfont.name:='times new roman'; //hint font type
Screen.hintfont.color:=clRed; //hint font color
Screen.hintfont.style:=[fsbold,fsitalic]; //hint style
end;
anyway... for a normal hint, you just need to set the Hint property on the component with what you wanna show and the ShowHint property to True example
Hint := 'This is a hint';
ShowHint := True;
you can set at the Object Inspector
for the component show his parent Hint, set the property ParentShowHInt to True
i hope its what you are talking about hahahaha