Learn message (16): Test message $0118

Source: Internet
Author: User
Current understanding of message $0118:

1. Neither Microsoft nor Delphi have defined a constant for the modified message. It is more appropriate to use wm_systimer imer if it is defined;

2. This message is sent only when the focus is obtained by text input controls (such as tmemo, trichedit, and tedit) to control the input cursor;

3. The message is synchronized with the input cursor once per second;

4. Once the message reaches its purpose, it is returned immediately. Therefore, the message method, wndproc, dispatch, and even defaulthandler cannot respond;

5. Because application. processmessages first sends the message to application. onmessage, onmessage can be received.

In this example:


Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls, comctrls, appevets; Type tform1 = Class (tform) button1: tbutton; button2: tbutton; applicationevents1: tapplicationevents; Procedure button1click (Sender: tobject); Procedure applicationevents1message (var msg: tagmsg; var handled: Boolean); end; var form1: tform1; implementation {$ R *. DFM} procedure tform1.applicationevents1message (var msg: tagmsg; var handled: Boolean); begin if MSG. message = $0118 then begin text: = timetostr (now); end; Procedure tform1.button1click (Sender: tobject); const W = 150; H = 50; L = 10; vaR T: integer; begin T: = L; with tmemo. create (Self) Do begin parent: = self; text: = classname; width: = W; Height: = H; left: = L; top: = T; Inc (t, H + l); end; with trichedit. create (Self) Do begin parent: = self; text: = classname; width: = W; Height: = H; left: = L; top: = T; Inc (t, H + l); end; with tedit. create (Self) Do begin parent: = self; text: = classname; width: = W; // Height: = H; left: = L; top: = T; // Inc (T, H + l); end; text: = 'current text input control has no focal point'; button1.enabled: = false; end.
 
   
 

Form file:

 
Object form1: tform1 left = 0 Top = 0 caption = 'form1' clientheight = 165 clientwidth = 320 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false pixelsperinch = 96 textheight = 13 object button1: tbutton left = 176 Top = 32 width = 136 Height = 25 caption = #24314 #31435 #20960 #20010 #25991 #26412 #36755 #20837 #25511 #20214 # taborder = 0 onclick = button1click end object button2: tbutton left = 176 Top = 83 width = 136 Height = 25 caption = #25226 #28966 #28857 #36716 #31227 #21040 #27492 taborder = 1 end object applicationevents1: tapplicationevents onmessage = applicationevents1message left = 136 Top = 64 endend

  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.