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

Autocomplete

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


Joined: 14 Jun 2007
Posts: 16

PostPosted: Tue Jun 03, 2008 2:39 pm    Post subject: Autocomplete Reply with quote

This question has been asked before in the classic forums (couple of years ago) and i was wondering if this was possible in kixforms.net

I`d like to build an autocomplete function like IE does when entering an url. So it automaticly suggests a matching known value (from a list i prefill) while the user is typing, but keeping the added part selected so it is overwritten when you keep typing.

Anyone know if this is possible? Thanks in advance for your reply`s!
Back to top
View user's profile Send private message
AJ83
KiXforms Follower
KiXforms Follower


Joined: 14 Jun 2007
Posts: 16

PostPosted: Thu Jul 17, 2008 4:12 pm    Post subject: Reply with quote

To be complete, here`s how i`ve done it (with help of the first stab from Shawn in a thread in advanced scripting forum)

Code:
Break On
$System = CreateObject("KiXforms.System")

;endregion

;region Form Creation
;Warning: It is recommended that changes inside this region be handled using the ScriptForm Designer.
;When working with the ScriptForm designer this region and any changes within may be overwritten.

;~~< Form1 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$Form1 = $System.Form()
$Form1.Size = $System.Size(278, 111)
$Form1.Text = "Form1"
;~~< ComboBox1 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ComboBox1 = $Form1.Controls.Add($System.ComboBox())
$ComboBox1.Size = $System.Size(215, 21)
$ComboBox1.SelectedIndex = -1
$ComboBox1.Location = $System.Point(12, 38)
$ComboBox1.TabIndex = 0
$ComboBox1.KeyPress = "AutoComplete( $$ComboBox1 )"
$ComboBox1.Keydown = "AutoCompleteBackspace( $$ComboBox1 )"
;endregion

;region Event Loop
fillarray()

$Form1.Show
While $Form1.Visible
   $=Execute($System.Application.DoEvents)
Loop

;endregion

;endregion
Function fillarray()
$array = Split("apenhoofd,aap,apenstreek,aapinjehaar",",")
EndFunction

Function AutoCompleteBackspace( $object )
Dim $text,$len,$keychar

$KeyChar = $object.KeyDownEventArgs.KeyCode

If $ComboBox1.items.count = 0
   Return
EndIf

If $keychar = 8
   $text = $combobox1.text
   $len = Len($text)
   $ComboBox1.text = Left($text,($len-1))
EndIf

EndFunction

;~~< GoComboBox >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Function AutoComplete( $object )
Dim $text,$len
$text = $ComboBox1.text
$len = Len($text)
;$ComboBox1.DroppedDown = 0

$ComboBox1.items.clear
If $ComboBox1.text <> ""
   For $i = 0 to UBound($array)
      If $text = Left($array[$i],$len)
         $ComboBox1.items.add($array[$i])
         $ComboBox1.Text = $array[$i]
         $ComboBox1.selectionstart = $len
         $ComboBox1.selectionlength = Len(Right($array[$i],Len($array[$i]) - $len))
      EndIf
   Next
   ;$ComboBox1.DroppedDown = -1
   $ComboBox1.selectionstart = $len
EndIf
EndFunction


Thanks Shawn for your help!
Back to top
View user's profile Send private message
Jochen
KiXforms Devotee
KiXforms Devotee


Joined: 05 Mar 2003
Posts: 1204
Location: Stuttgart, Germany

PostPosted: Tue Jul 22, 2008 6:20 pm    Post subject: Reply with quote

Can you link me to the post concerning the kf.classic try? (I still am not at all involved in the kf.net thing Very Happy)

I somehow missed that one... Sad

_________________
Jochen

Tell me, and I will forget.
Show me, and I may remember.
Involve me, and I will understand.
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: Tue Jul 22, 2008 7:30 pm    Post subject: Reply with quote

http://www.kixforms.org/forum/viewtopic.php?t=1634
_________________
Parents were invented to make children happy by giving them something to ignore.
Back to top
View user's profile Send private message
Jochen
KiXforms Devotee
KiXforms Devotee


Joined: 05 Mar 2003
Posts: 1204
Location: Stuttgart, Germany

PostPosted: Wed Jul 23, 2008 3:27 am    Post subject: Reply with quote

Oh, thanks Garg,

I thought this was a real question and not a working code sample Embarassed
No brain food for me then Crying or Very sad

_________________
Jochen

Tell me, and I will forget.
Show me, and I may remember.
Involve me, and I will understand.
Back to top
View user's profile Send private message 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