Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TScreen???

Status
Not open for further replies.

pandigunta

Programmer
Aug 22, 2000
12
US
Hi,
I am creating a new window in Borland c++ Builder, what i need is if I click on the X mark on the top rightmost corner, then the screen shouldn't close.Do you have any idea which class I need to do this.
Thanks
Pandigunta
 
I'm not sure I understand. If you click Close which is what the X does, do you want to:
1)create another Window or
2)do you want to close the current Window and create a new Window or
3)do you want to disable the Close button? James P. Cottingham
 
Hi,
What I need is , disable the close button.

Pandigunta
 
The easiest way to to disable all the icons on the border. You can do this by going to the form's properties and setting BorderIcons to all false. You might also want to change BorderStyle to bsDialog, too to get rid of the border entirely.

WARNING: If you do this, you will need some alternative way to close the form.

James P. Cottingham
 
If you still want the Icon, but refuse the user to Close the application by Clicking the [x], then using CloseQuerY(…) is one easy way to do this!

// Asuming the form name is Form1
void __fastcall TForm1::FormCloseQuery(TObject *Sender, bool &CanClose)
{
CanClose = false; // this will refuse the user to "close" the application by clicking [x]
}
// but if you want to enable the user att any point to close the window
bool UserCanClose = false
void __fastcall TForm1::Button1Click(TObject *Sender)
{
UserCanClose = true;
Close();
}
void __fastcall TForm1::FormCloseQuery(TObject *Sender, bool &CanClose)
{
CanClose = UserCanClose; // this will allow/refuse the user to close by clicking [x] depending of what value UserCanClose has.
}

Martin G Broman
mgb_svea@thevortex.com

DWS - Alpha Whitin Dead Wolf Society
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top