Author Topic: Close a form if another form is opened  (Read 1818 times)


  • New Member
  • *
  • Posts: 31
Close a form if another form is opened
« on: March 16, 2015, 12:25:44 pm »
Hi guys!

I make a program for students to practice calculating. For some kinds of practices, the students are allowed to use a calculator, which I already made in a single form, but for other practices, they are not allowed to use it. So when they open a form for practices with + - * / , the calculator have to can not be opened. And if the calculator is already opened, the form should close when another form is opened.
How can I achieve this?



  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: Close a form if another form is opened
« Reply #1 on: March 16, 2015, 01:26:27 pm »
you can set  visible property of the form (or hide procedure) and maybe a contitional global variable if required
also if you do not want to hide and show the form all the time you might want to just disable it with enable:=false
another way is to show the form inside the create event of the forms that you want it present and hide the form inside the onclose or ondestroy event of these forms
« Last Edit: March 16, 2015, 05:45:31 pm by Never »
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε


TinyPortal © 2005-2018