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

kixforms.net button.click

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


Joined: 15 Aug 2006
Posts: 2

PostPosted: Tue Aug 15, 2006 10:05 am    Post subject: kixforms.net button.click Reply with quote

I have a problem, that i can not understand.

when i run the script, it give my an error.

System.NullReferenceException: Objektreferencen er ikke indstillet til en forekomst af et objekt. ttranslated to english "Object reference not set to an instance of an object"

at Kixforms.Control.OnOnClick(Object sender, EventArgs e)

Code:
;*************************************************************************
;  Script Name:   Login script administrativ network
;  Author:        John Mortensen
;  Date:          14-08-2006
;  Description:   controls login scriopt on ad server and citrx solution with wmware
;  Kix version:   4.52 beta 2
;  Kix forms  :   2.08 Kixforms.net
;
;*************************************************************************
;
;
;
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

$Form3 = $System.Form()
$Form3.BackColor = $System.Color.FromName("Desktop")
$Form3.Left = 70
$Form3.StartPosition = 0  ;FormStartPosition_Manual
$Form3.Size = $System.Size(568,363) ;(Width,Height)
$Form3.Text = "Vælg standardprinter"
$Form3.Top = 373

$Label1 = $System.Label()
$Label1.BackColor = $System.Color.FromName("HighlightText")
$Label1.BorderStyle = 1  ;FixedSingle
$Label1.Font = $System.Font("Tahoma",12,1) ;Bold
$Label1.Height = 50
$Label1.Left = 30
$Label1.Text = "Husk at vælge printer, dette gøres for at sikre at du får den rigtige printer"
$Label1.Top = 10
$Label1.Width = 490
$nul = $Form3.Controls.Add($Label1)

$Label2 = $System.Label()
$Label2.BorderStyle = 1  ;FixedSingle
$Label2.Font = $System.Font("Tahoma",12,1) ;Bold
$Label2.Left = 30
$Label2.Text = "Fredericia"
$Label2.Top = 60
$nul = $Form3.Controls.Add($Label2)

$Label3 = $System.Label()
$Label3.BorderStyle = 1  ;FixedSingle
$Label3.Font = $System.Font("Tahoma",12,1) ;Bold
$Label3.Left = 330
$Label3.Text = "Horsens"
$Label3.Top = 60
$nul = $Form3.Controls.Add($Label3)

$Button1 = $System.Button()
$Button1.BackColor = $System.Color.FromName("Desktop")
$Button1.Font = $System.Font("Tahoma",10,1) ;Bold
$button1.cursor = 8
$Button1.FlatStyle = 3  ;System
$Button1.Left = 30
$Button1.Text = "&0 Lærergang"
$Button1.Top = 90
$Button1.Width = 180
$=A()
$button1.click = A()
$nul = $Form3.Controls.Add($Button1)



$Form3.Show  ;Displays the Form

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

Function A()
exit 0

endfunction


Can anyone help me.
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Tue Aug 15, 2006 11:36 am    Post subject: Reply with quote

Yeah, this is the situation.

You assign the Button click event here:

$button1.click = A()

But it should look like this (with quotes around it):

$button1.click = "A()"

In the first case - your not really assigning function A() to the Click event - your assign the return value of calling function A() to Click - which is "nothing".

-Shawn
Back to top
View user's profile Send private message
jjmccoy
KiXforms Novice
KiXforms Novice


Joined: 15 Aug 2006
Posts: 2

PostPosted: Tue Aug 15, 2006 12:59 pm    Post subject: Reply with quote

Hey Shawn

Thank you,

but what am i doing wrong?

i can not call the function a().

The script stays in the loop.

Can you help me?

john
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Tue Aug 15, 2006 1:03 pm    Post subject: Reply with quote

Your code seems to work ok for me ... here's your code with a MessageBox inside the Click event:

Code:

;*************************************************************************
;  Script Name:   Login script administrativ network
;  Author:        John Mortensen
;  Date:          14-08-2006
;  Description:   controls login scriopt on ad server and citrx solution with wmware
;  Kix version:   4.52 beta 2
;  Kix forms  :   2.08 Kixforms.net
;
;*************************************************************************
;
;
;
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

$Form3 = $System.Form()
$Form3.BackColor = $System.Color.FromName("Desktop")
$Form3.Left = 70
$Form3.StartPosition = 0  ;FormStartPosition_Manual
$Form3.Size = $System.Size(568,363) ;(Width,Height)
$Form3.Text = "Vælg standardprinter"
$Form3.Top = 373

$Label1 = $System.Label()
$Label1.BackColor = $System.Color.FromName("HighlightText")
$Label1.BorderStyle = 1  ;FixedSingle
$Label1.Font = $System.Font("Tahoma",12,1) ;Bold
$Label1.Height = 50
$Label1.Left = 30
$Label1.Text = "Husk at vælge printer, dette gøres for at sikre at du får den rigtige printer"
$Label1.Top = 10
$Label1.Width = 490
$nul = $Form3.Controls.Add($Label1)

$Label2 = $System.Label()
$Label2.BorderStyle = 1  ;FixedSingle
$Label2.Font = $System.Font("Tahoma",12,1) ;Bold
$Label2.Left = 30
$Label2.Text = "Fredericia"
$Label2.Top = 60
$nul = $Form3.Controls.Add($Label2)

$Label3 = $System.Label()
$Label3.BorderStyle = 1  ;FixedSingle
$Label3.Font = $System.Font("Tahoma",12,1) ;Bold
$Label3.Left = 330
$Label3.Text = "Horsens"
$Label3.Top = 60
$nul = $Form3.Controls.Add($Label3)

$Button1 = $System.Button()
$Button1.BackColor = $System.Color.FromName("Desktop")
$Button1.Font = $System.Font("Tahoma",10,1) ;Bold
$button1.cursor = 8
$Button1.FlatStyle = 3  ;System
$Button1.Left = 30
$Button1.Text = "&0 Lærergang"
$Button1.Top = 90
$Button1.Width = 180
$button1.click = "A()"
$nul = $Form3.Controls.Add($Button1)

$Form3.Show  ;Displays the Form

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

Function A()

 $= $System.MessageBox.Show("Trace")

 exit 0

endfunction
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