|
|||
|
I wonder if it is possible to produce a Tooltip or hint giving a
message about the current possible destination, while dragging a marquee from source to possible destinations, as the mouse passes over destination TGraphicControls. The mouse left button is down all the time during drag of the marquee. The mouse movement is being detected by WM_MOUSEMOVE with LParamLo - Hi. I have tried normal Hints but they do not display, and I have tried 3rd party FlagHint, but that displays only on leaving. I do not want a normal messageDlg with OK button. Thanks in anticipation |
|
|
||||
|
||||
|
|
|
|||
|
If you have the conditions to trigger it (ie have an event when yo want
to show the hint) then create a THintWindow. Here is a code snippet which displayed a hint containing HintStr over a string grid ... FileHint := THintWindow.Create(Self); with FileHint do begin Color := clInfoBk; // standard hint window colour {get rect for text in window} HintRect := CalcHintRect(StringGrid.Width, HintStr, nil); {hint must overlay the stringgrid row} HintY := ((Y div DefaultRowHeight) * DefaultRowHeight); {calculate hint position rect} with HintPosnRect, StringGrid do begin TopLeft := ClientToScreen(Point(ColWidths[0], HintY)); BottomRight := ClientToScreen(Point(ColWidths[0] + HintRect.Right, HintY + HintRect.Bottom)); end; {with HintPosnRect, StringGrid} ActivateHint(HintPosnRect, HintStr); end; {with FileHint} then of course you have to get rind of the hint window some time ... {in case file hint is left on screen} if FileHint <> nil then begin FileHint.ReleaseHandle; FileHint := nil; end; {if FileHint <> nil} Look up Delphi help on THintWindow. Alan Lloyd |
|
|||
|
Thank you Alan
for your most helpful code. I didn't even know there was a THintWindow I just thought hints were built in. regards Don Simmonds On 17 Apr 2005 23:35:15 -0700, "alanglloyd@aol.com" <alanglloyd@aol.com> wrote: >If you have the conditions to trigger it (ie have an event when yo want >to show the hint) then create a THintWindow. Here is a code snippet >which displayed a hint containing HintStr over a string grid ... > > FileHint := THintWindow.Create(Self); > with FileHint do begin > Color := clInfoBk; // standard hint window colour > {get rect for text in window} > HintRect := CalcHintRect(StringGrid.Width, HintStr, >nil); > {hint must overlay the stringgrid row} > HintY := ((Y div DefaultRowHeight) * DefaultRowHeight); > {calculate hint position rect} > with HintPosnRect, StringGrid do begin > TopLeft := ClientToScreen(Point(ColWidths[0], >HintY)); > BottomRight := ClientToScreen(Point(ColWidths[0] + >HintRect.Right, > HintY + >HintRect.Bottom)); > end; {with HintPosnRect, StringGrid} > ActivateHint(HintPosnRect, HintStr); > end; {with FileHint} > >then of course you have to get rind of the hint window some time ... > > {in case file hint is left on screen} > if FileHint <> nil then begin > FileHint.ReleaseHandle; > FileHint := nil; > end; {if FileHint <> nil} > >Look up Delphi help on THintWindow. > >Alan Lloyd |
|
|||
|
Note that in D3 the clInfoBk (info-tip background colour) is defined as
$80FFFF in Graphics.pas. This is much much yellower than the standard windows info-tip which is $E1FFFF. If this is the same in your version of Delphi then you would need to re-define clInfoBk to the correct colour as a const in your unit to have a hint matching the standard windows colour. I find using my own hint windows quite useful as I can control the colour and utilize a right-click on eg a treeview. Alan Lloyd |
|
|||
|
<alanglloyd@aol.com> wrote in message
news:1113852034.302193.47350@l41g2000cwc.googlegro ups.com... > Note that in D3 the clInfoBk (info-tip background colour) is defined as > $80FFFF in Graphics.pas. This is much much yellower than the standard > windows info-tip which is $E1FFFF. If this is the same in your version > of Delphi then you would need to re-define clInfoBk to the correct > colour as a const in your unit to have a hint matching the standard > windows colour. > > I find using my own hint windows quite useful as I can control the > colour and utilize a right-click on eg a treeview. *You* control the colour? That seems just a little off. What happened to setting the hint window colour in the Control Panel? Groetjes, Maarten Wiltink |
|
|||
|
Hi Alan,
I see you always refer to D3. Don't you own a later version ? Thanks Aaron <alanglloyd@aol.com> wrote in message news:1113852034.302193.47350@l41g2000cwc.googlegro ups.com... > Note that in D3 the clInfoBk (info-tip background colour) is defined as > $80FFFF in Graphics.pas. This is much much yellower than the standard > windows info-tip which is $E1FFFF. If this is the same in your version > of Delphi then you would need to re-define clInfoBk to the correct > colour as a const in your unit to have a hint matching the standard > windows colour. > > I find using my own hint windows quite useful as I can control the > colour and utilize a right-click on eg a treeview. > > Alan Lloyd > |
|
|||
|
> *You* control the colour? That seems just a little off. What happened
to > setting the hint window colour in the Control Panel? For a particular application I have a treeview of dictations displaying one item of its data. When the user right-clicks on a treenode, a hint window is shown displaying all the dictation data. The background is coloured according to the priority of the dictation. For standard hints why should I change the colour from the system colour. For every rule there is occasionally an exception. "Rules are for the compliance of fools, but the guidance of wise men". Alan Lloyd |
|
|||
|
<alanglloyd@aol.com> wrote in message
news:1113890977.070910.312600@f14g2000cwb.googlegr oups.com... > *You* control the colour? That seems just a little off. What happened >> to setting the hint window colour in the Control Panel? > > For a particular application I have a treeview of dictations > displaying one item of its data. When the user right-clicks on a > treenode, a hint window is shown displaying all the dictation data. > The background is coloured according to the priority of the dictation. So it wouldn't really matter there if the standard colour didn't match the "standard" colour? > For standard hints why should I change the colour from the system > colour. For every rule there is occasionally an exception. "Rules > are for the compliance of fools, but the guidance of wise men". True. Having rules is good. Knowing when to deviate from them is even better. Groetjes, Maarten Wiltink |
|
|||
|
Delphi 3 does all I need at the moment. Mainly about 50Kloc of sound
recording and control (in PCM, GSM, & DSS formats and conversion between them), but I guess I will have to make a big jump soon. I see speech recognition coming over the horizon - send for the cavalry <g>. Alan Lloyd |
|
|||
|
The color isn't an issue thanks, well as far as the background goes,
but I do want to change the font colour and it seems to always be black. I have tried Font.color and I have tried canvas.font.color to no avail. Am I missing something? Regards Don Simmonds On 18 Apr 2005 12:20:34 -0700, "alanglloyd@aol.com" <alanglloyd@aol.com> wrote: >Note that in D3 the clInfoBk (info-tip background colour) is defined as >$80FFFF in Graphics.pas. This is much much yellower than the standard >windows info-tip which is $E1FFFF. If this is the same in your version >of Delphi then you would need to re-define clInfoBk to the correct >colour as a const in your unit to have a hint matching the standard >windows colour. > >I find using my own hint windows quite useful as I can control the >colour and utilize a right-click on eg a treeview. > >Alan Lloyd |
|
|||
|
Possibly beyond your present knowledge <g>
The font colour is set in the Paint procedure of the THintWindow so you cannot directly change. Wha you have to do is define a descendant class of THintWindow which has a Paint procedure which overrides THintWindow.Paint. In that overriding PaintProcedure you set the color to the one you want. Or better still declare a TextColor property in the descendant which you can set to any color you desire. type TColorTextHintWindow = class(THintWindow) protected procedure Paint; override; end; implementation var FileHint : THintWindow; procedure TColorTextHintWindow.Paint; {this code copied from THintWindow.Paint in Controls.pas} var R: TRect; begin R := ClientRect; Inc(R.Left, 2); Inc(R.Top, 2); Canvas.Font.Color := clRed; // changed colour of text from clInfoText DrawText(Canvas.Handle, PChar(Caption), -1, R, DT_LEFT or DT_NOPREFIX or DT_WORDBREAK); end; .... then ... FileHint := TColorTextHintWindow.Create(Self); // etc etc Alan Lloyd |
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Re: Log, Error message color | toby dunn | Newsgroup comp.soft-sys.sas | 0 | 05-24-2006 04:13 PM |
| Re: SQL: Poor ERROR message or inability to intepret it | Ian Whitlock | Newsgroup comp.soft-sys.sas | 0 | 04-19-2006 11:21 PM |
| Re: SQL: Poor ERROR message or inability to intepret it | Venky Chakravarthy | Newsgroup comp.soft-sys.sas | 0 | 04-18-2006 01:56 PM |
| Re: Controlling the Message Line from Base SAS | Kevin Myers | Newsgroup comp.soft-sys.sas | 0 | 12-12-2005 04:43 AM |
| money!!! | deck.bound@mac.com | Newsgroup comp.soft-sys.sas | 0 | 01-03-2005 12:07 PM |