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

Close form and dispose its variables

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


Joined: 03 Oct 2005
Posts: 57
Location: Rotterdam - Netherlands

PostPosted: Tue Nov 11, 2008 3:04 pm    Post subject: Close form and dispose its variables Reply with quote

Might be a simple one but I canít find a solution just yet.

Lets say that $form2 is started from $form1 using a Call command. When $form2 is closed (with .Close .Dispose or .Hide) all variables used in $form2 are still alive so if you call $form2 again without closing the kix session you get some errors about doubly defined variables.

Is there a way to destroy all variables used on $form2 when $from2 is closed or disposed?

_________________
Mart

- He's chained forever to a world that's departed.....It's not enough, it's not enough - Sorrow by Pink Floyd.
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


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

PostPosted: Tue Nov 11, 2008 11:02 pm    Post subject: Reply with quote

Oy Mart, long time no text.

I think we can come up with a salution that gets you what you need, Not sure what your working on but I try to make one form the parent and the rest children of the parent. Not knowing what the end goal is it is hard to direct you, can you give me some code your working on or a snipet so i can help you beter?

_________________
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
Mart
KiXforms Regular
KiXforms Regular


Joined: 03 Oct 2005
Posts: 57
Location: Rotterdam - Netherlands

PostPosted: Wed Nov 12, 2008 4:15 pm    Post subject: Reply with quote

Oy Benny, sup?

I changed jobs (read: my previous employer stopped all business activities so I was forced to look for a new job) so it has been quiet on the KF battle field for me until now.

What I'm doing is writing a system monitoring application. This can monitor availability, services and free space on the local drives (potentially more if needed). There is a form that is the main application and a second form to add new systems to the list of systems to be monitored.

Have a look at the code below. Click the button on form1, click cancel on form 2 (or the top right X) and click the button on form one again. An error about a doubly defined UDF shows up in the console window when the second form opens.
The main application form needs to work to post it here because it is still in development mode so I made a quick and dirty test first form.

I think it is in the way the second form is started but I'm not completely sure.

Form1 (form1.kix)
Code:

Break On
$System = CreateObject("Kixforms.System")
If Not $System
   $nul= MessageBox("KiXforms.Net Not Initiated. This Script Will Now Close.","Error",16)
   Quit()
EndIf
$nul = $System.Application.EnableVisualStyles

$Form1 = $System.Form()
$Form1.Left = 325
$Form1.StartPosition = 0  ;FormStartPosition_Manual
$Form1.Size = $System.Size(290,292) ;(Width,Height)
$Form1.Text = "Form1"
$Form1.Top = 284

$Button1 = $System.Button()
$Button1.Left = 80
$Button1.Text = "Open form2"
$Button1.Top = 70
$Button1.Click = "OpenForm2()"
$nul = $Form1.Controls.Add($Button1)

$Label1 = $System.Label()
$Label1.BorderStyle = 1  ;FixedSingle
$Label1.Left = 40
$Label1.Text = "Hi, this is the first form"
$Label1.Top = 30
$Label1.Width = 170
$nul = $Form1.Controls.Add($Label1)

$Form1.Show  ;Displays the Form

While $Form1.Visible
   $Nul = Execute($Form1.DoEvents())
Loop
Exit 0

Function OpenForm2()
   Call @SCRIPTDIR + "\new_system.kix"
EndFunction


Form2 (new_system.kix)
Code:

Break On
$System = CreateObject("Kixforms.System")
If Not $System
   $nul= MessageBox("KiXforms.Net Not Initiated. This Script Will Now Close.","Error",16)
   Quit()
EndIf
$nul = $System.Application.EnableVisualStyles

$Form2 = $System.Form()
$Form2.MaximizeBox = 0  ;False
$Form2.MinimizeBox = 0  ;False
$Form2.StartPosition = 1  ;FormStartPosition_CenterScreen
$Form2.Size = $System.Size(465,334) ;(Width,Height)
$Form2.Text = "New system data..."

$GroupBoxNewSystem = $System.GroupBox()
$GroupBoxNewSystem.Height = 290
$GroupBoxNewSystem.Left = 10
$GroupBoxNewSystem.Text = "System information"
$GroupBoxNewSystem.Top = 10
$GroupBoxNewSystem.Width = 440
$nul = $Form2.Controls.Add($GroupBoxNewSystem)

$TextBoxSystemnameNewSystem = $System.TextBox()
$TextBoxSystemnameNewSystem.Left = 10
$TextBoxSystemnameNewSystem.Text = ""
$TextBoxSystemnameNewSystem.Top = 50
$TextBoxSystemnameNewSystem.Width = 200
$nul = $GroupBoxNewSystem.Controls.Add($TextBoxSystemnameNewSystem)

$ButtonCancelNewSystem = $System.Button()
$ButtonCancelNewSystem.Height = 70
$ButtonCancelNewSystem.ImageAlign = 2  ;Top,Center
$ButtonCancelNewSystem.Left = 350
$ButtonCancelNewSystem.Text = "Cancel"
$ButtonCancelNewSystem.TextAlign = 512  ;BottomCenter
$ButtonCancelNewSystem.Top = 210
$ButtonCancelNewSystem.Click = "ButtonCancelNewSystem()"
$nul = $GroupBoxNewSystem.Controls.Add($ButtonCancelNewSystem)
;$ButtonCancelNewSystem.Image = Button2Image()

$LabelSystemNameNewSystem = $System.Label()
$LabelSystemNameNewSystem.Height = 20
$LabelSystemNameNewSystem.Left = 10
$LabelSystemNameNewSystem.Text = "System name"
$LabelSystemNameNewSystem.Top = 30
$nul = $GroupBoxNewSystem.Controls.Add($LabelSystemNameNewSystem)

$ButtonSaveNewSystem = $System.Button()
$ButtonSaveNewSystem.Height = 70
$ButtonSaveNewSystem.ImageAlign = 2  ;Top,Center
$ButtonSaveNewSystem.Left = 260
$ButtonSaveNewSystem.Text = "Save"
$ButtonSaveNewSystem.TextAlign = 512  ;BottomCenter
$ButtonSaveNewSystem.Top = 210
$ButtonSaveNewSystem.Click = "ButtonSaveNewSystem()"
$nul = $GroupBoxNewSystem.Controls.Add($ButtonSaveNewSystem)
;$ButtonSaveNewSystem.Image = Button1Image()

$LabelIPAddressNewSystem = $System.Label()
$LabelIPAddressNewSystem.Height = 20
$LabelIPAddressNewSystem.Left = 10
$LabelIPAddressNewSystem.Text = "IP address"
$LabelIPAddressNewSystem.Top = 80
$nul = $GroupBoxNewSystem.Controls.Add($LabelIPAddressNewSystem)

$TextBoxIPAddressNewSystem = $System.TextBox()
$TextBoxIPAddressNewSystem.Left = 10
$TextBoxIPAddressNewSystem.Text = ""
$TextBoxIPAddressNewSystem.Top = 100
$TextBoxIPAddressNewSystem.Width = 200
$nul = $GroupBoxNewSystem.Controls.Add($TextBoxIPAddressNewSystem)

$ComboBoxSystemTypeNewSystem = $System.ComboBox()
$ComboBoxSystemTypeNewSystem.DropDownWidth = 200
$ComboBoxSystemTypeNewSystem.Left = 230
$ComboBoxSystemTypeNewSystem.Text = ""
$ComboBoxSystemTypeNewSystem.Top = 50
$ComboBoxSystemTypeNewSystem.Width = 200
$nul = $GroupBoxNewSystem.Controls.Add($ComboBoxSystemTypeNewSystem)
$ComboBoxSystemTypeNewSystemItem0 = $ComboBoxSystemTypeNewSystem.Items.Add("Line1")
$ComboBoxSystemTypeNewSystemItem1 = $ComboBoxSystemTypeNewSystem.Items.Add("Line2")
$ComboBoxSystemTypeNewSystemItem2 = $ComboBoxSystemTypeNewSystem.Items.Add("Line3")

$LabelSystemTypeNewSystem = $System.Label()
$LabelSystemTypeNewSystem.Height = 20
$LabelSystemTypeNewSystem.Left = 230
$LabelSystemTypeNewSystem.Text = "System type"
$LabelSystemTypeNewSystem.Top = 30
$nul = $GroupBoxNewSystem.Controls.Add($LabelSystemTypeNewSystem)

$LabelSystemRoleNewSystem = $System.Label()
$LabelSystemRoleNewSystem.Height = 20
$LabelSystemRoleNewSystem.Left = 230
$LabelSystemRoleNewSystem.Text = "System role"
$LabelSystemRoleNewSystem.Top = 80
$nul = $GroupBoxNewSystem.Controls.Add($LabelSystemRoleNewSystem)

$ComboBoxSystemRoleNewSystem = $System.ComboBox()
$ComboBoxSystemRoleNewSystem.DropDownWidth = 200
$ComboBoxSystemRoleNewSystem.Left = 230
$ComboBoxSystemRoleNewSystem.Text = ""
$ComboBoxSystemRoleNewSystem.Top = 100
$ComboBoxSystemRoleNewSystem.Width = 200
$nul = $GroupBoxNewSystem.Controls.Add($ComboBoxSystemRoleNewSystem)
$ComboBoxSystemRoleNewSystemItem0 = $ComboBoxSystemRoleNewSystem.Items.Add("Line1")
$ComboBoxSystemRoleNewSystemItem1 = $ComboBoxSystemRoleNewSystem.Items.Add("Line2")
$ComboBoxSystemRoleNewSystemItem2 = $ComboBoxSystemRoleNewSystem.Items.Add("Line3")

$ComboBoxNewSystem = $System.ComboBox()
$ComboBoxNewSystem.DropDownWidth = 200
$ComboBoxNewSystem.Left = 10
$ComboBoxNewSystem.Text = ""
$ComboBoxNewSystem.Top = 250
$ComboBoxNewSystem.Width = 200
$nul = $GroupBoxNewSystem.Controls.Add($ComboBoxNewSystem)
$ComboBoxNewSystemItem0 = $ComboBoxNewSystem.Items.Add("Line1")
$ComboBoxNewSystemItem1 = $ComboBoxNewSystem.Items.Add("Line2")
$ComboBoxNewSystemItem2 = $ComboBoxNewSystem.Items.Add("Line3")

$ComboBoxCountryNewSystem = $System.ComboBox()
$ComboBoxCountryNewSystem.DropDownWidth = 200
$ComboBoxCountryNewSystem.Left = 10
$ComboBoxCountryNewSystem.Text = ""
$ComboBoxCountryNewSystem.Top = 200
$ComboBoxCountryNewSystem.Width = 200
$nul = $GroupBoxNewSystem.Controls.Add($ComboBoxCountryNewSystem)
$ComboBoxCountryNewSystemItem0 = $ComboBoxCountryNewSystem.Items.Add("Line1")
$ComboBoxCountryNewSystemItem1 = $ComboBoxCountryNewSystem.Items.Add("Line2")
$ComboBoxCountryNewSystemItem2 = $ComboBoxCountryNewSystem.Items.Add("Line3")

$LabelCountryNewSystem = $System.Label()
$LabelCountryNewSystem.Height = 20
$LabelCountryNewSystem.Left = 10
$LabelCountryNewSystem.Text = "Country"
$LabelCountryNewSystem.Top = 180
$nul = $GroupBoxNewSystem.Controls.Add($LabelCountryNewSystem)

$LabelOSNewSystem = $System.Label()
$LabelOSNewSystem.Height = 20
$LabelOSNewSystem.Left = 10
$LabelOSNewSystem.Text = "Operating system"
$LabelOSNewSystem.Top = 230
$nul = $GroupBoxNewSystem.Controls.Add($LabelOSNewSystem)

$LabelSubnetNewSystem = $System.Label()
$LabelSubnetNewSystem.Height = 20
$LabelSubnetNewSystem.Left = 10
$LabelSubnetNewSystem.Text = "Subnetmask"
$LabelSubnetNewSystem.Top = 130
$nul = $GroupBoxNewSystem.Controls.Add($LabelSubnetNewSystem)

$TextBoxSubnetNewSystem = $System.TextBox()
$TextBoxSubnetNewSystem.Left = 10
$TextBoxSubnetNewSystem.Text = ""
$TextBoxSubnetNewSystem.Top = 150
$TextBoxSubnetNewSystem.Width = 200
$nul = $GroupBoxNewSystem.Controls.Add($TextBoxSubnetNewSystem)

$Form2.Show  ;Displays the Form

While $Form2.Visible
   $Nul = Execute($Form2.DoEvents())
Loop
Exit 0


Function SaveButtonNewSystem()
   If Not Exist( @SCRIPTDIR + "\files\systems\" + $TextBoxSystemnameNewSystem.Text + ".ini"
      $rc = WriteProfileString("file", "section", "value", "data")
   Else
      $rc = MessageBox("The system " + $TextBoxSystemnameNewSystem.Text + " already exists.", "Save...", 48)
   EndIf
      
EndFunction

Function ButtonCancelNewSystem()
   $form2.Close
EndFunction

_________________
Mart

- He's chained forever to a world that's departed.....It's not enough, it's not enough - Sorrow by Pink Floyd.
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


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

PostPosted: Wed Nov 12, 2008 5:35 pm    Post subject: Reply with quote

Let me know if this is what you are looking for?

Code:

Break On
$System = CreateObject("Kixforms.System")
If Not $System
  $nul = MessageBox("KiXforms.Net Not Initiated. This Script Will Now Close.", "Error", 16)
  Quit()
EndIf
$nul = $System.Application.EnableVisualStyles

$Form1 = $System.Form()
$Form1.Left = 325
$Form1.StartPosition = 0  ;FormStartPosition_Manual
$Form1.Size = $System.Size(290, 292) ;(Width,Height)
$Form1.Text = "Form1"
$Form1.Top = 284
$Form1.Closing = "ClosingForm1()"  ;Needed to Catch the Closing Events

$Button1 = $System.Button()
$Button1.Left = 80
$Button1.Text = "Open form2"
$Button1.Top = 70
$Button1.Click = "OpenForm2()"
$nul = $Form1.Controls.Add($Button1)

$Label1 = $System.Label()
$Label1.BorderStyle = 1  ;FixedSingle
$Label1.Left = 40
$Label1.Text = "Hi, this is the first form"
$Label1.Top = 30
$Label1.Width = 170
$nul = $Form1.Controls.Add($Label1)

LoadForm2()

$Form1.Show  ;Displays the Form

While $Form1.Visible
  $Nul = Execute($Form1.DoEvents())
Loop
Exit 0

Function LoadForm2()
 
  $Form2 = $System.Form()
  $Form2.MaximizeBox = 0  ;False
  $Form2.MinimizeBox = 0  ;False
  $Form2.StartPosition = 1  ;FormStartPosition_CenterScreen
  $Form2.Size = $System.Size(465, 334) ;(Width,Height)
  $Form2.Text = "New system data..."
  $Form2.Closing = "ClosingForm2()"  ;Needed to Catch the Closing Events
 
  $GroupBoxNewSystem = $System.GroupBox()
  $GroupBoxNewSystem.Height = 290
  $GroupBoxNewSystem.Left = 10
  $GroupBoxNewSystem.Text = "System information"
  $GroupBoxNewSystem.Top = 10
  $GroupBoxNewSystem.Width = 440
  $nul = $Form2.Controls.Add($GroupBoxNewSystem)
 
  $TextBoxSystemnameNewSystem = $System.TextBox()
  $TextBoxSystemnameNewSystem.Left = 10
  $TextBoxSystemnameNewSystem.Text = ""
  $TextBoxSystemnameNewSystem.Top = 50
  $TextBoxSystemnameNewSystem.Width = 200
  $nul = $GroupBoxNewSystem.Controls.Add($TextBoxSystemnameNewSystem)
 
  $ButtonCancelNewSystem = $System.Button()
  $ButtonCancelNewSystem.Height = 70
  $ButtonCancelNewSystem.ImageAlign = 2  ;Top,Center
  $ButtonCancelNewSystem.Left = 350
  $ButtonCancelNewSystem.Text = "Cancel"
  $ButtonCancelNewSystem.TextAlign = 512  ;BottomCenter
  $ButtonCancelNewSystem.Top = 210
  $ButtonCancelNewSystem.Click = "ClosingForm2()"
  $nul = $GroupBoxNewSystem.Controls.Add($ButtonCancelNewSystem)
  ;$ButtonCancelNewSystem.Image = Button2Image()
 
  $LabelSystemNameNewSystem = $System.Label()
  $LabelSystemNameNewSystem.Height = 20
  $LabelSystemNameNewSystem.Left = 10
  $LabelSystemNameNewSystem.Text = "System name"
  $LabelSystemNameNewSystem.Top = 30
  $nul = $GroupBoxNewSystem.Controls.Add($LabelSystemNameNewSystem)
 
  $ButtonSaveNewSystem = $System.Button()
  $ButtonSaveNewSystem.Height = 70
  $ButtonSaveNewSystem.ImageAlign = 2  ;Top,Center
  $ButtonSaveNewSystem.Left = 260
  $ButtonSaveNewSystem.Text = "Save"
  $ButtonSaveNewSystem.TextAlign = 512  ;BottomCenter
  $ButtonSaveNewSystem.Top = 210
  $ButtonSaveNewSystem.Click = "ButtonSaveNewSystem()"
  $nul = $GroupBoxNewSystem.Controls.Add($ButtonSaveNewSystem)
  ;$ButtonSaveNewSystem.Image = Button1Image()
 
  $LabelIPAddressNewSystem = $System.Label()
  $LabelIPAddressNewSystem.Height = 20
  $LabelIPAddressNewSystem.Left = 10
  $LabelIPAddressNewSystem.Text = "IP address"
  $LabelIPAddressNewSystem.Top = 80
  $nul = $GroupBoxNewSystem.Controls.Add($LabelIPAddressNewSystem)
 
  $TextBoxIPAddressNewSystem = $System.TextBox()
  $TextBoxIPAddressNewSystem.Left = 10
  $TextBoxIPAddressNewSystem.Text = ""
  $TextBoxIPAddressNewSystem.Top = 100
  $TextBoxIPAddressNewSystem.Width = 200
  $nul = $GroupBoxNewSystem.Controls.Add($TextBoxIPAddressNewSystem)
 
  $ComboBoxSystemTypeNewSystem = $System.ComboBox()
  $ComboBoxSystemTypeNewSystem.DropDownWidth = 200
  $ComboBoxSystemTypeNewSystem.Left = 230
  $ComboBoxSystemTypeNewSystem.Text = ""
  $ComboBoxSystemTypeNewSystem.Top = 50
  $ComboBoxSystemTypeNewSystem.Width = 200
  $nul = $GroupBoxNewSystem.Controls.Add($ComboBoxSystemTypeNewSystem)
  $ComboBoxSystemTypeNewSystemItem0 = $ComboBoxSystemTypeNewSystem.Items.Add("Line1")
  $ComboBoxSystemTypeNewSystemItem1 = $ComboBoxSystemTypeNewSystem.Items.Add("Line2")
  $ComboBoxSystemTypeNewSystemItem2 = $ComboBoxSystemTypeNewSystem.Items.Add("Line3")
 
  $LabelSystemTypeNewSystem = $System.Label()
  $LabelSystemTypeNewSystem.Height = 20
  $LabelSystemTypeNewSystem.Left = 230
  $LabelSystemTypeNewSystem.Text = "System type"
  $LabelSystemTypeNewSystem.Top = 30
  $nul = $GroupBoxNewSystem.Controls.Add($LabelSystemTypeNewSystem)
 
  $LabelSystemRoleNewSystem = $System.Label()
  $LabelSystemRoleNewSystem.Height = 20
  $LabelSystemRoleNewSystem.Left = 230
  $LabelSystemRoleNewSystem.Text = "System role"
  $LabelSystemRoleNewSystem.Top = 80
  $nul = $GroupBoxNewSystem.Controls.Add($LabelSystemRoleNewSystem)
 
  $ComboBoxSystemRoleNewSystem = $System.ComboBox()
  $ComboBoxSystemRoleNewSystem.DropDownWidth = 200
  $ComboBoxSystemRoleNewSystem.Left = 230
  $ComboBoxSystemRoleNewSystem.Text = ""
  $ComboBoxSystemRoleNewSystem.Top = 100
  $ComboBoxSystemRoleNewSystem.Width = 200
  $nul = $GroupBoxNewSystem.Controls.Add($ComboBoxSystemRoleNewSystem)
  $ComboBoxSystemRoleNewSystemItem0 = $ComboBoxSystemRoleNewSystem.Items.Add("Line1")
  $ComboBoxSystemRoleNewSystemItem1 = $ComboBoxSystemRoleNewSystem.Items.Add("Line2")
  $ComboBoxSystemRoleNewSystemItem2 = $ComboBoxSystemRoleNewSystem.Items.Add("Line3")
 
  $ComboBoxNewSystem = $System.ComboBox()
  $ComboBoxNewSystem.DropDownWidth = 200
  $ComboBoxNewSystem.Left = 10
  $ComboBoxNewSystem.Text = ""
  $ComboBoxNewSystem.Top = 250
  $ComboBoxNewSystem.Width = 200
  $nul = $GroupBoxNewSystem.Controls.Add($ComboBoxNewSystem)
  $ComboBoxNewSystemItem0 = $ComboBoxNewSystem.Items.Add("Line1")
  $ComboBoxNewSystemItem1 = $ComboBoxNewSystem.Items.Add("Line2")
  $ComboBoxNewSystemItem2 = $ComboBoxNewSystem.Items.Add("Line3")
 
  $ComboBoxCountryNewSystem = $System.ComboBox()
  $ComboBoxCountryNewSystem.DropDownWidth = 200
  $ComboBoxCountryNewSystem.Left = 10
  $ComboBoxCountryNewSystem.Text = ""
  $ComboBoxCountryNewSystem.Top = 200
  $ComboBoxCountryNewSystem.Width = 200
  $nul = $GroupBoxNewSystem.Controls.Add($ComboBoxCountryNewSystem)
  $ComboBoxCountryNewSystemItem0 = $ComboBoxCountryNewSystem.Items.Add("Line1")
  $ComboBoxCountryNewSystemItem1 = $ComboBoxCountryNewSystem.Items.Add("Line2")
  $ComboBoxCountryNewSystemItem2 = $ComboBoxCountryNewSystem.Items.Add("Line3")
 
  $LabelCountryNewSystem = $System.Label()
  $LabelCountryNewSystem.Height = 20
  $LabelCountryNewSystem.Left = 10
  $LabelCountryNewSystem.Text = "Country"
  $LabelCountryNewSystem.Top = 180
  $nul = $GroupBoxNewSystem.Controls.Add($LabelCountryNewSystem)
 
  $LabelOSNewSystem = $System.Label()
  $LabelOSNewSystem.Height = 20
  $LabelOSNewSystem.Left = 10
  $LabelOSNewSystem.Text = "Operating system"
  $LabelOSNewSystem.Top = 230
  $nul = $GroupBoxNewSystem.Controls.Add($LabelOSNewSystem)
 
  $LabelSubnetNewSystem = $System.Label()
  $LabelSubnetNewSystem.Height = 20
  $LabelSubnetNewSystem.Left = 10
  $LabelSubnetNewSystem.Text = "Subnetmask"
  $LabelSubnetNewSystem.Top = 130
  $nul = $GroupBoxNewSystem.Controls.Add($LabelSubnetNewSystem)
 
  $TextBoxSubnetNewSystem = $System.TextBox()
  $TextBoxSubnetNewSystem.Left = 10
  $TextBoxSubnetNewSystem.Text = ""
  $TextBoxSubnetNewSystem.Top = 150
  $TextBoxSubnetNewSystem.Width = 200
  $nul = $GroupBoxNewSystem.Controls.Add($TextBoxSubnetNewSystem)
 
EndFunction 

Function OpenForm2()
  $Form2.Show  ;Displays the Form
EndFunction

Function ButtonSaveNewSystem()
  If Not Exist( @SCRIPTDIR + "\files\systems\" + $TextBoxSystemnameNewSystem.Text + ".ini"
    $rc = WriteProfileString("file", "section", "value", "data")
  Else
    $rc = MessageBox("The system " + $TextBoxSystemnameNewSystem.Text + " already exists.", "Save...", 48)
  EndIf
EndFunction

Function ClosingForm1()
  If $Form2.Visible =-1
    $rc = MessageBox("Warning closing this window will close all windows" + @CRLF + "Do you want to close all windows?", "Warning", 52)
    If $rc = 7
      $Form1.ClosingEventArgs.Cancel = -1  ;Catches Closing Events and Cancels them
    Else
      ExitForm()
    EndIf
  Else
    ExitForm()
  EndIf
EndFunction

Function ClosingForm2()
  $Form2.Hide  ;Hides the Form
  $Form2.ClosingEventArgs.Cancel = -1  ;Catches Closing Events and Cancels them
EndFunction

Function ExitForm()
  Quit()
EndFunction

_________________
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
Mart
KiXforms Regular
KiXforms Regular


Joined: 03 Oct 2005
Posts: 57
Location: Rotterdam - Netherlands

PostPosted: Thu Nov 13, 2008 8:55 am    Post subject: Reply with quote

As always this work great. Cool
Thanks. I never thought of doing it this way.

_________________
Mart

- He's chained forever to a world that's departed.....It's not enough, it's not enough - Sorrow by Pink Floyd.
Back to top
View user's profile Send private message
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