KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Using Multiple Forms

 
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion
View previous topic :: View next topic  
Author Message
apronk
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2006
Posts: 53
Location: The Netherlands

PostPosted: Mon Apr 16, 2007 12:59 pm    Post subject: Using Multiple Forms Reply with quote

I've been experiencing problems with multiple forms.
Most likely due to my own KixForms.net malpractise Razz
Anyway to get to the point, from Form1 a button cals for Form2 using the following code
Code:

  $Form1.Hide
  $Form2.Center
  $Form2.Show
  While $Form2.Visible
    $=Execute($Form2.DoEvents)
  Loop
  $Form1.Show

This works fine the first time you open and close (using the top right X) form2. However using the same code to open Form2 a second time fails.
This code did work in KixForms 2.x

Any ideas anyone ?

_________________
Achieve inner peace through outer violence.
Back to top
View user's profile Send private message Visit poster's website
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Mon Apr 16, 2007 2:23 pm    Post subject: Reply with quote

Yeah, think I know whats going on ... in .net when you close the form - it destroys the form ... which is bad for re-showing it.

You have to capture the Closing event. Then Cancel the event in the CancelEventArgs object available in the System.EventArgs property. Then Hide the form instead.

Pain-in-the-butt but thats just how dotnet works.

-Shawn
Back to top
View user's profile Send private message
apronk
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2006
Posts: 53
Location: The Netherlands

PostPosted: Mon Apr 16, 2007 2:28 pm    Post subject: Reply with quote

Damn... this is where Kix would have "Dim As New" handy.
Then you could do something like Dim $f2 as New $Form2.
Then it wouln't matter if the form is destroyed.

Anyway could you post an example ?

_________________
Achieve inner peace through outer violence.
Back to top
View user's profile Send private message Visit poster's website
apronk
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2006
Posts: 53
Location: The Netherlands

PostPosted: Mon Apr 16, 2007 2:55 pm    Post subject: Reply with quote

Got it!
Code:

$Form2.Closing = "$$=CancelClose($$System.EventArgs)"

Function CancelClose($args)
  $args.Cancel = 1
  $Form2.Hide
EndFunction


Thanks for the suggestion Shawn Smile

_________________
Achieve inner peace through outer violence.
Back to top
View user's profile Send private message Visit poster's website
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Mon Apr 16, 2007 3:14 pm    Post subject: Reply with quote

Beat me to it ;0)

Nice work.

-Shawn
Back to top
View user's profile Send private message
apronk
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2006
Posts: 53
Location: The Netherlands

PostPosted: Mon Apr 16, 2007 3:19 pm    Post subject: Reply with quote

Hehe, thx Smile
Couln't have done it without your help.

_________________
Achieve inner peace through outer violence.
Back to top
View user's profile Send private message Visit poster's website
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Mon Apr 16, 2007 5:22 pm    Post subject: Reply with quote

Yeah, Shawns' th man Wink
_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion All times are GMT
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
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group