Visit our Sponsor   Visit our Sponsor
delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback





Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi







Startblatt.de






Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (0)


Show message in OnEnter eventGo to Fernando Silva's websiteFormat this article printer-friendly!Bookmark function is only available for registered users!
Product:
Delphi all versions
Category:
GUI
Skill Level:
Scoring:
Last Update:
09/02/2002
Search Keys:
delphi delphi3000 article borland vcl code-snippet show message onenter
Times Scored:
2
Visits:
2962
Uploader: Fernando Silva
Company: W3 Computadores, Lda
Reference: N/A
 
Question/Problem/Abstract:
Do you ever needed to display a message using the OnEnter event?
This example shows how to correctly display a message by using the ShowMessage (or an equivalent function) in OnEnter event.
Answer:



As you have notice, if you call ShowMessage in OnEnter event, mouse will get a bad behavior.
Remember that this problem only occurs when the control executes the OnEnter event after you clicked it with the mouse.

The trick is by using a user windows message.


const
  UM_SHOWMESSAGE = WM_USER + 256;

// Define this procedure to catch our 'ShowMessage' user message
procedure UMShowMessage(var Message: TMessage); message UM_SHOWMESSAGE;

procedure TForm1.UMShowMessage(var Message: TMessage);
begin
  ShowMessage(PChar(Message.lParam));
end;


To activate the message you just need to put this code in OnEnter event:

PostMessage(Handle, UM_SHOWMESSAGE, 0, LPARAM(PChar('This is a message')));





Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment













 
Sign up to consume product discounts for Bronze memberships !

read more


  Visit our Sponsor

 

  Community Ad of
E. Irigoyen
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)