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

Default Button

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


Joined: 01 Apr 2003
Posts: 19
Location: Netherlands

PostPosted: Tue Jun 05, 2007 1:22 pm    Post subject: Default Button Reply with quote

Hi

How can I set a default Button.
To respond when I hit ENTER in a textbox? Embarassed

Peter
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 Jun 05, 2007 3:26 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
pvds
KiXforms Follower
KiXforms Follower


Joined: 01 Apr 2003
Posts: 19
Location: Netherlands

PostPosted: Tue Jun 05, 2007 4:54 pm    Post subject: Reply with quote

Yes,

Thanks this is wher I was lookking for.

Thanks
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