User: alciro    User
 Original    Translate to:  Deutsch  English  Français  中文  
 

Programación en C++ Builder

 Arrays (arrays)
 Pointers
3. Example of class in c + +
8. AnsiString class methods
 C + + projects
 Packages, distribute an application without installation
 Exchange or bubble sorting
 String string.h functions

7.2. Derivatives TCustomForm

Close ()

The method Close () closes the form, but before a call to the function CloseQuery () to ask if it is properly closed.

CloseQuery function () event handler calls the OnCloseQuery. If the variable passes the handler logic is false, the form is not closed and if true, the form is closed normally.

You can use the event handler OnCloseQuery to ask the user to save a file that has not been saved before closing the formualario.

Note: When the application form closes, the application terminates.

 void __fastcall Close(void); 

Following the method Closer to form Called When a button is clicked Done:

 void __fastcall TForm1::DoneClick(TObject *Sender) { Close(); } 

CloseQuery ()

CloseQuery is used to determine if the form can be closed. If the form can be closed, CloseQuery returns true otherwise returns false.

For an MDI parent form, CloseQuery CloseQuery calls methods of the MDI child forms to determine the return value.

 bool __fastcall CloseQuery(void); 

DefocusControl ()

Removes the focus of a control on the form.

 void __fastcall DefocusControl(Controls::TWinControl* Control, bool Removing); 

FocusControl ()

The focus of an active control on the form.

 void __fastcall FocusControl(Controls::TWinControl* Control); 

GetFormImage ()

Hide ()

Hides the form memory without downloading. The hide method works by placing visible property to false.

 HIDESBASE void __fastcall Hide(void); 

This code uses a button and a timer on a form. When the user clicks the button, the form Disappears for the Specified Period of time in the Interval property of the timer control, Then the form Reappears:

 void __fastcall TForm1:: Button1Click (TObject * Sender)
{
  Timer1-> Enabled = true;
  Hide ();
}
void __fastcall TForm1:: Timer1Timer (TObject * Sender)
{
  Visible = true;
  Timer1-> Enabled = false;
} 

Print ()

Prints the form content. Just print the client area, does not print the legend, the title bar or borders. It is a useful method for quick dumps the form to the printer.

 __fastcall void Print (void); 

This example uses a button on a form named Print. When the user Chooses the button, the form prints.

 void __fastcall TForm1:: PrintClick (TObject * Sender)
{
   Print ();
} 

Release ()

Destroy the form and releases the memory occupied by it.

 __fastcall void Release (void); 

This example displays a message box about the form going away, calls Release, and Terminates the application.

 void __fastcall TForm1:: ButtonClick (TObject * Sender)
{
Application-> MessageBox ("This form is going away forever", "Release Notice", MB_OK);
Release ();
Application-> Terminate ();
} 

SendCancelMode ()

SetFocus ()

Activates the form and placed in the foreground. In ActiveControl property specifies the component that receives focus.

 __fastcall virtual void SetFocus (void); 

When the user clicks the button on this form, the list box control Becomes the active and Receive the input focus:

 void __fastcall TForm1:: Button1Click (TObject * Sender)
{
   ListBox1-> SetFocus ();
} 

SetFocusedControl ()

Focus a control on the form.

 bool __fastcall SetFocusedControl (Controls:: TWinControl * Control); 

Show ()

Show () opens a form in a fashion not l (additional forms can be activated while it is visible).

Note: The Show method works on placing the form's Visible property to true.

 HIDESBASE __fastcall void Show (void); 

This code puts away the current form and displays Another:

 void __fastcall TForm1:: Button1Click (TObject * Sender)
{
Form1-> Hide ();
Form2-> Show ();
} 

To run this example you Must include the header file for Form2.

ShowModal ()

With ShowModal, the form runs modal (modal form must be closed to keep working with the application.)

 int __fastcall ShowModal (void); 

This code uses two forms and a button on the first form. The user must-close Form3 Before The focus returns to Form1.

 # Include "Unit3.h"
void __fastcall TForm1:: ButtonClick (TObject * Sender)
{
Form3-> ShowModal ();
} 
Loading
copyright © 2007-2024  www.alciro.org  All rights reserved.         
Share |