BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TProgressBar,TLabel,TEdit etc. shows the current position or

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Juergen Langer
Guest





PostPosted: Sat Mar 26, 2005 10:55 pm    Post subject: TProgressBar,TLabel,TEdit etc. shows the current position or Reply with quote



Hi,

when I move the mouse cursor over a object and let it there e.g. over a
TProgressBar, Label, or other component, how can I shows the current value
(the position or value of the object is change continual below the mouse
cursor) on a hint?

Thanks for your help.

Juergen



Back to top
Vladimir Stefanovic
Guest





PostPosted: Sun Mar 27, 2005 9:12 am    Post subject: Re: TProgressBar,TLabel,TEdit etc. shows the current positio Reply with quote



If I understoud well, you should learn about THintWindow
class. This is the sample code. Place one TLabel on the form,
increase the font size.

As you can see, I used the event OnLeave() for detecting when
the hint should be dismissed, which for other controls has to be
implemented manually.

--- H ---

// ...
THintWindow *FHintWindow;
__fastcall ~TForm1();
// ...

--- CPP ---

__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
FHintWindow = new THintWindow(this);
FHintWindow->Color=clInfoBk;

Label1->Width = 200;
Label1->Height = 200;
Label1->AutoSize = false;
}
__fastcall TForm1::~TForm1()
{
FHintWindow->ReleaseHandle();
delete FHintWindow;
}
void __fastcall TForm1::Label1MouseMove(TObject *Sender, TShiftState Shift,
int X, int Y)
{
AnsiString T = IntToStr( X ) + ", " + IntToStr( Y );
TRect R = FHintWindow->CalcHintRect( Screen->Width, T, NULL );

OffsetRect( &R, X + Left + Label1->Left, Y+Top+Label1->Top );
FHintWindow->ActivateHint( R, T );
}
void __fastcall TForm1::Label1MouseLeave(TObject *Sender)
{
FHintWindow->ReleaseHandle();
}





--
Best regards,
Vladimir Stefanovic
"Juergen Langer" <juergen-langer (AT) web (DOT) de> wrote

Quote:
Hi,

when I move the mouse cursor over a object and let it there e.g. over a
TProgressBar, Label, or other component, how can I shows the current value
(the position or value of the object is change continual below the mouse
cursor) on a hint?

Thanks for your help.

Juergen






Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.