[Gambas-user] Me.Close in a multi-form application

2010-08-11 Thread vikram
hi,

i have a multiform application, on the Close event of each form a confirmation 
dialog is displayed. 

The user clicks a button on each form to move to the next one(or clicks a 
button to go back to the previous form), when he/she does this the current 
form's Visible property is set to false and that of the desired form is set to 
true.

When the user exits the application, Me.Close would only close the current form 
and all previous forms would remain in memory. I remember reading from the 
documentation that QUIT should not be used in GUI applications. If i close all 
previously opened forms by using FormName.Close each form's confirmation dialog 
pops up.

I've been thinking of way out of this, the only idea i've been able to come up 
with is that if there is a way a function could tell who called it, i could use 
that to prevent the confirmation dialogs from being displayed on form close. 

Say user closes Form C, now Forms A  B are have their Visible property set to 
False so they are hidden. On the Close event of Form C i call Form A,B  C's 
Close method. If Form A  B's Close method could tell that they've been called 
from another form, then maybe i could prevent the confirmation dialogs from 
popping up. Or could there be some other way to do this?

I have a attached a sample application which illustrates the problem.

Thanks in advance :)
Vikram Shankar Nair



  

multiformClose.tar.gz
Description: GNU Zip compressed data
--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev ___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Me.Close in a multi-form application

2010-08-11 Thread Bruce Bruen
Hi Vikram,

There are probably much better ways to do what you are trying to do, but its 
hard to suggest them fro the sample.

But for a quick answer:
PUBLIC SUB Form_Close()
  DIM retval AS Integer
  
  IF NOT ME.Visible THEN 
ME.Close
RETURN 
  ENDIF 
  
  retval = Message.Question(Are you sure you want to exit FormA?, Yes, 
No)
  
  IF retval = 1
ME.Close
  ELSE 
STOP EVENT 
  END IF
  
END


-- 
best regards
Bruce Bruen

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user