Introduction to Delphi xe2 firemonkey (36)-control basics: tform

Source: Internet
Author: User
When I read form1.stylelookup for the first time and expect "formstyle" to appear, it is indeed "backgroundstyle "...

Now I understand that the original form contains a trectangle object:

 
Uses FMX. objects; Procedure tform1.button1click (Sender: tobject); begin (self. children [0] As trectangle ). fill. color: = clared; // by default, this rectangle can be read through children [0], but its order (INDEX) is variable showmessage (Children [0]. tostring); // The trectangle {Panel1 is also a rectangle object, so should there be others} trectangle (panel1.children [0]). fill. color: = clayellow; end;
Currently, there are only eight events in the FMX form. I have counted as many as 40 events in the traditional VCL form.
Eight are missing points, but their superiors have many virtual methods that can be covered, such:
Mousedown, mouseup, mousemove, mouseleave, mousewheel, dragdrop, dragenter, dragover, dragleave, keydown, keyup, etc.
They do not appear in the form of events, probably because the designer thinks that these events are rarely used in the form.

Test: override mousemove to respond to mouse movement events:

Unit unit1; interfaceuses system. sysutils, system. types, system. uitypes, system. classes, system. variants, FMX. types, FMX. controls, FMX. forms, FMX. dialogs; Type tform1 = Class (tform) Private Public {In the tform1 declaration area-> Ctrl + space-> enter mousem... -> press ENTER-> SHIFT + Ctrl + c} procedure mousemove (shift: tshiftstate; X: single; Y: single); override; end; var form1: tform1; implementation {$ R *. FMX} procedure tform1.mousemove (shift: tshiftstate; X, Y: single); begin inherited; caption: = format ('% F, % F', [x, y]); end; end.
Tform inheritance chain: tfmxobject-> tcommoncustomform-> tcustomform-> tform

Tcommoncustomform proposes or implements the public functions of tform and tform3d;
Tcustomform implements the iscene interface and provides canvas and style functions;
Tform does not have function extensions, but only changes some Members to published to be available during design.

{Tcommoncustomform} public constructor create (...); override; // constructor createnew (...); virtual; // It has an additional default parameter dummy than create (), but it does not see any purpose (it may be used for a 3D Window); For now it and create () there is no difference between destructor destroy; override; // procedure initializenewform; virtual; // form initialization. You can override this method to initialize the form attributes procedure afterconstruction; override; // procedure forebedestruction after creation; override; // procedure addobject (...) before destruction (...); override; // Add object {children} function objectatpoint (...): iControl; virtual; // control {called from platform} procedure setmarkedtext (...) at the specified position (...); virtual; // confirm the text before input when using the input method; overwrite this method to intercept procedure paintrects (...); virtual; // update the specified rectangle (array) range. It is only available in tcustomform. Code Procedure mousedown (...); virtual; // procedure mousemove (...) in response to the mouse event (...); virtual ;//... procedure mouseup (...); virtual ;//... procedure mousewheel (...); virtual ;//... procedure mouseleave; virtual ;//... procedure keydown (...); virtual; // responds to the keyboard event procedure keyup (...); virtual ;//... function getimewindowrect: trectf; virtual; // obtain the range rectangle with the input focus object procedure activate; // activate procedure deactivate; // cancel procedure dragenter (...); virtual; // response to the drag-and-drop event procedure dragover (...); virtual ;//... procedure dragdrop (...); virtual ;//... procedure dragleave; virtual ;//... procedure entermenuloop; // call the startmenuloop method {settings} procedure setbounds (...) of the tmenubar object (...); virtual; // set the position and size function clienttoscreen (...): tpointf; // point Conversion Function screentoclient (...): tpointf ;//... function closequery: Boolean; virtual; // triggers the onclosequery event function clientrect: trectf; // the client area rectangle procedure release; // releases procedure close; // closes Procedure show; // display procedure hide; // hide function showmodal: tmodalresult; // display as a modal window procedure closemodal; // trigger onclosequery and onclose event procedure invalidate; // forcibly refresh procedure beginupdate because it is invalid; // start to update procedure endupdate; // end to update property handle: tfmxhandle ...; // window handle property contexthandle: thandle ...; // environment handle property modalresult: tmodalresult ...; // The Return Value of the modal window property formstate: tfmxformstates ...; // window mode status property designer: idesignerhook ...; // design-related interface {iroot} property captured: iControl ...; // The property focused: iControl ...; // property hovered: iControl ...; // property isactive: Boolean ...; // whether the status is active property bidimode: tbidimode ...; // property caption in different languages: String ...; // Title property cursor: tcursor ...; // The cursor type property borderstyle: tfmxformborderstyle ...; // border style property bordericons: tbordericons ...; // The property clientheight button on the toolbar: integer ...; // clientwidth: integer ...; // property margins: tbound ...; // The padding property position: tformposition ...; // relative position property width: integer ...; // wide property Height: integer ...; // high property showactivated: Boolean ...; // whether to activate property staysopen when enabling: Boolean ...; // whether to delay enabling property transparency: Boolean ...; // whether the property topmost can be transparent: Boolean ...; // whether it is in the top-level property visible: Boolean ...; // hide property windowstate: twindowstate ...; // window status (normal, maximized, and minimized) Property oncreate: tpolicyevent ...; // property ondestroy: tpolicyevent ...; // property onclose: tcloseevent ...; // property onclosequery: tclosequeryevent ...; // property onactivate: tpolicyevent ...; // property ondeactivate: tpolicyevent ...; // property onresize: tpolicyevent ...; // adjust published property left: integer ...; // left property top: integer ...; // upload end; {tcustomform} public constructor create (...); override; // constructor createnew (...); override; // destructor destroy; override; // release procedure initializenewform; override; // initialize form, which should be procedure addobject (...) automatically called internally (...); override; // Add the procedure updatestyle object; // update the style property canvas: TCanvas ...; // Drawing Layer property fill: tbrush ...; // painter property stylebook: tstylebook ...; // style sheet property activecontrol: tstyledcontrol ...; // activate the control or obtain the activated control property stylelookup: String ...; // specify the control style name property onpaint: tonpaintevent ...; // end when re-painting;

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.