View previous topic :: View next topic |
Author |
Message |
pvds KiXforms Follower

Joined: 01 Apr 2003 Posts: 19 Location: Netherlands
|
Posted: Tue Jun 05, 2007 1:22 pm Post subject: Default Button |
|
|
Hi
How can I set a default Button.
To respond when I hit ENTER in a textbox?
Peter |
|
Back to top |
|
 |
benny69 KiXforms Advocate


Joined: 30 Oct 2003 Posts: 567 Location: Lincoln, Ne
|
Posted: Tue Jun 05, 2007 3:26 pm Post subject: |
|
|
Hi pvds,
I think 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
$Form = $System.Form()
$Form.Left = 0
$Form.StartPosition = 0 ;FormStartPosition_Manual
$Form.Size = $System.Size(511,300) ;(Width,Height)
$Form.Text = "Default OK Button [Enter] & Cancel Button [Esc]"
$Form.Top = 0
$OKButton = $System.Button()
$OKButton.Click = "OK_Click()"
$OKButton.Left = 330
$OKButton.Text = "OK"
$OKButton.Top = 230
$nul = $Form.Controls.Add($OKButton)
$CancelButton = $System.Button()
$CancelButton.Click = "Cancel_Click()"
$CancelButton.DialogResult = 2 ;Cancel
$CancelButton.Left = 410
$CancelButton.Text = "Cancel"
$CancelButton.Top = 230
$nul = $Form.Controls.Add($CancelButton)
$Label = $System.Label()
$Label.Height = 20
$Label.Left = 60
$Label.Text = "Button Pressed:"
$Label.TextAlign = 64 ;MiddleRight
$Label.Top = 100
$Label.Width = 110
$nul = $Form.Controls.Add($Label)
$TextBox = $System.TextBox()
$TextBox.Left = 190
$TextBox.Text = ""
$TextBox.Top = 100
$nul = $Form.Controls.Add($TextBox)
$Form.AcceptButton = $OKButton
$Form.CancelButton = $CancelButton
$Form.Show ;Displays the Form
While $Form.Visible
$Nul = Execute($Form.DoEvents())
Loop
Exit 0
Function OK_Click()
$TextBox.Text = "OK Clicked"
EndFunction
Function Cancel_Click()
$TextBox.Text = "Cancel Clicked"
EndFunction
|
_________________ Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta) |
|
Back to top |
|
 |
pvds KiXforms Follower

Joined: 01 Apr 2003 Posts: 19 Location: Netherlands
|
Posted: Tue Jun 05, 2007 4:54 pm Post subject: |
|
|
Yes,
Thanks this is wher I was lookking for.
Thanks |
|
Back to top |
|
 |
|