Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.pascal.misc > Newsgroup comp.lang.pascal.delphi.misc

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 04-17-2005, 05:12 PM
Donald Simmonds
Guest
 
Posts: n/a
Default Popup message while mouse held down

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
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 04-18-2005, 06:35 AM
alanglloyd@aol.com
Guest
 
Posts: n/a
Default Re: Popup message while mouse held down

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

Reply With Quote
  #3 (permalink)  
Old 04-18-2005, 06:17 PM
Donald Simmonds
Guest
 
Posts: n/a
Default Re: Popup message while mouse held down

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


Reply With Quote
  #4 (permalink)  
Old 04-18-2005, 07:20 PM
alanglloyd@aol.com
Guest
 
Posts: n/a
Default Re: Popup message while mouse held down

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

Reply With Quote
  #5 (permalink)  
Old 04-18-2005, 07:25 PM
Maarten Wiltink
Guest
 
Posts: n/a
Default Re: Popup message while mouse held down

<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


Reply With Quote
  #6 (permalink)  
Old 04-19-2005, 01:52 AM
Aaron Miles
Guest
 
Posts: n/a
Default Re: Popup message while mouse held down

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
>



Reply With Quote
  #7 (permalink)  
Old 04-19-2005, 06:09 AM
alanglloyd@aol.com
Guest
 
Posts: n/a
Default Re: Popup message while mouse held down

> *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

Reply With Quote
  #8 (permalink)  
Old 04-19-2005, 07:56 AM
Maarten Wiltink
Guest
 
Posts: n/a
Default Re: Popup message while mouse held down

<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


Reply With Quote
  #9 (permalink)  
Old 04-19-2005, 05:28 PM
alanglloyd@aol.com
Guest
 
Posts: n/a
Default Re: Popup message while mouse held down

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

Reply With Quote
  #10 (permalink)  
Old 04-19-2005, 07:50 PM
Donald Simmonds
Guest
 
Posts: n/a
Default Re: Popup message while mouse held down

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


Reply With Quote
  #11 (permalink)  
Old 04-19-2005, 09:33 PM
alanglloyd@aol.com
Guest
 
Posts: n/a
Default Re: Popup message while mouse held down

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

Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


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



All times are GMT. The time now is 01:03 PM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.