[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 622
  • Last Modified:

hint

can someone give me some working examples of how the hint works please delphi 6,7.
0
966
Asked:
966
  • 10
  • 5
  • 2
  • +1
1 Solution
 
cebassoCommented:
i really don't know exactly what are you talking about...
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
0
 
epasquierCommented:
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
0
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
966Author Commented:
Thanks , can i change the colour and font of the hint box ?
0
 
966Author Commented:
If i use flat hint, how would i add code to show a hint instead.

procedure TForm1.FlatHint1ShowHint(var HintStr: String;
  var CanShow: Boolean; var HintInfo: THintInfo);
begin

end;
0
 
966Author Commented:
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(var HintStr: String;
  var CanShow: Boolean; var HintInfo: THintInfo);
begin
flathint1.Create(label1);
end;
0
 
966Author Commented:
yes after i cancel the error box it works fine .. :(
0
 
epasquierCommented:
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

procedure SetupHintColor(C:TColor);
Const
 Element: TColor = COLOR_INFOBK;
begin
 SetSysColors(1, Element, C);
end;

Open in new window

0
 
966Author Commented:
doesnt matter about flat hint, stay with the standard one i think. So again, how would i change background from grey ?
0
 
966Author Commented:
ah cool, i just typed that withought rfreshing, ill check it out now
0
 
966Author Commented:
So if i wanted background colour blue and text colour red, how would the code be?
0
 
epasquierCommented:
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 :
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

Open in new window

0
 
epasquierCommented:
Sorry, that did not came out right (line return pb)
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

Open in new window

0
 
966Author Commented:
great!
0
 
966Author Commented:
procedure SetupHintColor(C:TColor);
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;

? like this?
0
 
966Author Commented:
not sure how to set it out mate, the above i posted is wrong i just relised.
0
 
senadCommented:
:-)))  ???

Anyway,if you can get TMS components it has a nice message box that works
perfect for hints and is highly configurable....
0
 
epasquierCommented:
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;

Open in new window

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 10
  • 5
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now