FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to find out if a form has been created

 
Post new topic   Reply to topic     Forum Index -> DFL
View previous topic :: View next topic  
Author Message
jicman



Joined: 22 Dec 2004
Posts: 298
Location: Rochester, NY

PostPosted: Sat Jun 16, 2007 11:30 pm    Post subject: How to find out if a form has been created Reply with quote

Greetings!

I have been looking in the Form help site, but I have not been able to see anything that I could use. I have a form called "Form1" that is created when I click a button. When I click this button, this Form gets created again. I would like to know if that form has already been created so that I will not create it again.

Any help would be greatly appreciate it.

thanks,

jic
Back to top
View user's profile Send private message
cracki



Joined: 07 May 2007
Posts: 10
Location: Germany

PostPosted: Sun Jun 17, 2007 9:07 am    Post subject: Reply with quote

you need to keep a handle to it.
_________________
...meh...
Back to top
View user's profile Send private message
jicman



Joined: 22 Dec 2004
Posts: 298
Location: Rochester, NY

PostPosted: Sun Jun 17, 2007 6:39 pm    Post subject: Reply with quote

Thanks.

Ok, this works ok,
Code:

  protected void btnReport_click(Object sender, EventArgs ea)
  {
    NewReportForm();
  }
  final void NewReportForm()
  {
    if (!ReportForm)
    {
      with(ReportForm = new Form)
      {
        text = "Choose What Report To Create";
        startPosition = dfl.form.FormStartPosition.CENTER_PARENT;
        with (new Button)
        {
          text = "Combined";
          location = Point(10, 10);
          parent = ReportForm;
          click ~= &CombinedReportClick;
        }
        show();
      }
    }
    else
    {
      ReportForm.activate();
      if (!ReportForm.activeForm())
      {
        ReportForm = null;
        NewReportForm();
      }
    }
  }


however, if I close the Form it will never come up. I guess I could create the form without a closing but I want to be able to do this. I am new to Windows and I could go and try all the thousands options available, but a little help will be better. Smile

Any ideas?

jic
Back to top
View user's profile Send private message
Chris Miller



Joined: 27 Mar 2004
Posts: 514
Location: The Internet

PostPosted: Fri Jul 06, 2007 11:10 am    Post subject: Reply with quote

I would cancel the closing event (closing ea.cancel = true) and instead hide() the form. In your 'else' (the ReportForm was created) you could simply show() it.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DFL All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group