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

How do I remove .AcceptButton from a button?

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


Joined: 28 Jun 2005
Posts: 40

PostPosted: Mon Nov 17, 2008 11:09 am    Post subject: How do I remove .AcceptButton from a button? Reply with quote

Got a small problem with .AcceptButton, or rather, removing it...

I have a small app where I have, say $Textbox1 and when someone enters it and starts typing, it sets $Form1.AcceptButton = $Button1

So far so good Smile

When the button is clicked it stores the info in Textbox1, and then sets Focus to $Textbox2.

This box has $Textbox2.AcceptsReturn = -1

What I want, is to be able to just press enter, and have the function processing the info in Textbox2, and then setting the focus back to box2, so one can keep entering info in box2.

I have that senario set up and functioning (if I don't use AcceptButton), so how do I clear the .AcceptButton from $Form1?


/Viggen
Back to top
View user's profile Send private message MSN Messenger
Gargoyle
KiXforms Aficionado
KiXforms Aficionado


Joined: 30 Dec 2003
Posts: 366
Location: Arizona

PostPosted: Mon Nov 17, 2008 1:02 pm    Post subject: Reply with quote

$Form1.AcceptButton = ""

$Button1.Visible = "False"
$Button1.Enabled = "False"

_________________
Parents were invented to make children happy by giving them something to ignore.
Back to top
View user's profile Send private message
Viggen
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2005
Posts: 40

PostPosted: Mon Nov 17, 2008 2:31 pm    Post subject: Reply with quote

Thanks for the reply, but it does not work.

If I print the result of $Button1.AcceptButton after I have done: $Form1.AcceptButton = ""

I still get "Kixforms.Button", and Button1 is still working with enter.

(although... strangely, Textbox2 works with CTRL + Enter ??) Stunned
Back to top
View user's profile Send private message MSN Messenger
benny69
KiXforms Advocate
KiXforms Advocate


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

PostPosted: Mon Nov 17, 2008 4:19 pm    Post subject: Reply with quote

Hi Viggen,

Can you post your code, maybe I can help you out?

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


Joined: 28 Jun 2005
Posts: 40

PostPosted: Mon Nov 17, 2008 7:52 pm    Post subject: Reply with quote

This script does what I want, except that I must click the button, instead of just pressing enter, after writing in Textbox1.

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 = 0
$Form1.StartPosition = 0  ;FormStartPosition_Manual
$Form1.Size = $System.Size(168,277) ;(Width,Height)
$Form1.Text = "Form1"
$Form1.Top = 0

$TextBox1 = $System.TextBox()
$TextBox1.Left = 31
$TextBox1.Text = ""
$TextBox1.Top = 32
$nul = $Form1.Controls.Add($TextBox1)

$TextBox2 = $System.TextBox()
$TextBox2.AcceptsReturn = -1  ;True
$TextBox2.Left = 35
$TextBox2.Text = ""
$TextBox2.Top = 207
$TextBox2.Visible = 0
$nul = $Form1.Controls.Add($TextBox2)

$Button1 = $System.Button()
$Button1.FlatStyle = 3  ;System
$Button1.Left = 42
$Button1.Text = "Button1"
$Button1.Top = 70
$Button1.Click = "Function1()"
$nul = $Form1.Controls.Add($Button1)

$Form1.Show  ;Displays the Form

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

Function Function1()
  $TextBox1.Text = ""
  $TextBox2.Visible = -1
  $TextBox2.Focus
  $TextBox2.KeyDown = "input()"
Endfunction

Function input()
  Dim $Keydown, $nul

  $Keydown = $TextBox2.KeyDownEventArgs.KeyCode
  If $Keydown = 13
    $nul = MessageBox('You wrote "' + $TextBox2.Text + '" in the textbox.','Info...',64)
    $TextBox2.Text = ""
  Endif
Endfunction


 
Back to top
View user's profile Send private message MSN Messenger
benny69
KiXforms Advocate
KiXforms Advocate


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

PostPosted: Mon Nov 17, 2008 8:55 pm    Post subject: Reply with quote

give this a try, see if it gets you what your 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 = 0
$Form1.StartPosition = 0  ;FormStartPosition_Manual
$Form1.Size = $System.Size(168, 277) ;(Width,Height)
$Form1.Text = "Form1"
$Form1.Top = 0

$TextBox1 = $System.TextBox()
$TextBox1.AcceptsReturn = -1  ;True
$TextBox1.Left = 31
$TextBox1.Text = ""
$TextBox1.Top = 32
$TextBox1.KeyDown = "Function1(0)"
$nul = $Form1.Controls.Add($TextBox1)

$TextBox2 = $System.TextBox()
$TextBox2.AcceptsReturn = -1  ;True
$TextBox2.Left = 35
$TextBox2.Text = ""
$TextBox2.Top = 207
$TextBox2.Visible = 0
$nul = $Form1.Controls.Add($TextBox2)

$Button1 = $System.Button()
$Button1.FlatStyle = 3  ;System
$Button1.Left = 42
$Button1.Text = "Button1"
$Button1.Top = 70
$Button1.Click = "Function1(1)"
$nul = $Form1.Controls.Add($Button1)

$ButtonClicked = 0
$Form1.Show  ;Displays the Form

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

Function Function1($ButtonClicked)
  $Keydown = $TextBox1.KeyDownEventArgs.KeyCode
  If $Keydown = 13 Or $ButtonClicked = 1
    $TextBox1.Text = ""
    $TextBox1.Enabled = 0
    $Button1.Enabled = 0
    $TextBox2.Visible = -1
    $TextBox2.Focus
    $TextBox2.KeyDown = "input()"
  EndIf
EndFunction

Function input()
  Dim $Keydown, $nul
   
  $Keydown = $TextBox2.KeyDownEventArgs.KeyCode
  If $Keydown = 13
    $nul = MessageBox('You wrote "' + $TextBox2.Text + '" in the textbox.', 'Info...', 64)
    $TextBox2.Text = ""
  EndIf
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
Viggen
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2005
Posts: 40

PostPosted: Mon Nov 17, 2008 10:25 pm    Post subject: Reply with quote

Aaahh!
Of course!
Skip the .AcceptButton Smile

Thanks Benny!
Works perfect!
Yet again you have saved me Very Happy

/Viggen
Back to top
View user's profile Send private message MSN Messenger
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Tue Nov 18, 2008 7:24 pm    Post subject: Reply with quote

hmm...
if accept button is empty and you are not "tabbed" to the button, as example, if you are writing into the box, form should not do anything when pressing enter.

_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Tue Nov 18, 2008 8:13 pm    Post subject: Reply with quote

oh, and that post was just to clarify that acceptbutton really does work. as it should.

what is weird is that button.acceptbutton has a value as it isn't supported in .net, as far as I know...

_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
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