Quickly and easily change the window into a fusion window

Source: Internet
Author: User

Suppose you want to change the modal window to a fused window, and the Atomic window is the Tform type window.
Components used: Raize 5.x (Don't ask me why not tframe)
Currently popular with Raize Rzpagecontrol to do the fusion window, because it comes with tabsheet close buttons and events, so everyone use this.
My implementation is to put a rztabsheet when the first page, the above shows a number of notification announcements, to-do reminders of the project, and then all the sub-modules of the window is dynamically created to Rzpagecontrol, create the code as follows:

Procedure Tfrmmain.n13click (sender:tobject); var  f                 : tfrmcalltask;//need to pass variables to the submodule, so define  Tabctrl           : trztabsheet;//container  i                 : integer;begin for  I: = 0 to Rzpagecontrol1.pagecount-1 do    if rzpagecontrol1.pages [i]. Caption = ' Task List ' then    begin      Rzpagecontrol1.pages[i]. Show;      Exit;    end;//here is based on the title of the Submodule window to differentiate whether there is no build, the live achievement activates the display  Tabctrl: = Trztabsheet.create (RZPAGECONTROL1);//Create Container  Tabctrl.pagecontrol: = rzpagecontrol1;//container Attribution  Rzpagecontrol1.activepageindex: = tabctrl.pageindex;//Activate Container page  F: = Tfrmcalltask.create (Tabctrl);//Create window  //I use Tform instead of tframe, so there is a window caption for these properties  tabctrl.caption: = f . caption;//with the window caption when the tab name  F.manualdock (Tabctrl);//merge the window into the container  f.align: = alclient;//window Adaptive  f.vu: = vu;// Here is the set of variables in the window module, of course, you can also manipulate the component  f.vn: = VN;  F.show;  f.setfocus;//window display and make a focus end;

About the key events in the window, that is, onkeypress, because I use the tform, so I can directly use this event, just switch components, need to be processed in the form of messages, the code is as follows:

Procedure tfrmcalllist.edit1keypress (Sender:tobject; var key:char); Begin  if (Key = #13) then  begin    Key: = # 0;    PostMessage (Handle, WM_KEYDOWN, Vk_tab, 0);//Simulation Press TAB key    //perform (wm_nextdlgctl, 1, 0);//mode window is valid, dissolve window is invalid  end; End

On the closure of the fusion window, it is also simple, as long as the Rzpagecontrol Close event set AllowClose to True, the code is as follows:

Procedure Tfrmmain.rzpagecontrol1close (Sender:tobject;var Allowclose:boolean); begin//because I do not want to close the "home" this rztabsheet, So it's OK to judge that.  allowclose: = RzPageControl1.ActivePage.Caption <> ' home ' end;

Other things, do not forget to set several related properties of Rzpagecontrol to display the tab style and the Close button on the line, such as Showclosebuttononactivetab is true, Showclosebutton this is false. Attached below:

Reference: HTTP://WWW.E8E.NET/POST/2B9E8B_B876C0 (Star Five's blog)

Quickly and easily change the window into a fusion window

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.