Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Autocomplete combo box???

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-07-2008, 06:57 AM
Basic4ppc Veteran
 
Join Date: Sep 2008
Location: Brisbane, Australia
Posts: 317
Default Autocomplete combo box???



Hi people,

I have written an app on my winmobile 6 ppc in VB.NET but am having what I think are memory leak problems and possibly problems with it's garbage disposal methods.

What I'd like to do is write my app in Basic4ppc but I need to have the functionality of an autocomplete combobox. I've created one in vb.net and would like to know if anyone has managed to implement something like this in Basic4ppc?

regards,

Ricky
Reply With Quote
  #2 (permalink)  
Old 09-08-2008, 12:01 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,344
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

Found this artile...
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)

My Posts helped you? Consider Buying me a Porto Glass!

Last edited by Cableguy : 09-08-2008 at 12:07 PM.
Reply With Quote
  #3 (permalink)  
Old 09-09-2008, 07:13 AM
Basic4ppc Veteran
 
Join Date: Sep 2008
Location: Brisbane, Australia
Posts: 317
Default Thanks but doesn't really help

Thanks Cableguy but this isn't what I need.

I need to be able to write it in Basic4ppc.

I have tried to do this with a TextBox and a ListBox.
The TextBox is where the user types.
The ListBox contains items that will be searched.

a Textbox in basic4ppc only has GotFocus, KeyPress and LostFocus events.

The one I created in VB.NET for mobile uses a combo box and textbox and the critical code is in the KeyUp event of the textbox - Basic4ppc doesn't have this event.

or are you suggesting I compile the code in the article you suggested and create it as a dll? If so I'm not sure how to do that and make it work in Basic4ppc.

I'm not sure what you are saying.
Reply With Quote
  #4 (permalink)  
Old 09-09-2008, 11:56 AM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,344
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

The code in the artical I referd you to, can easely be converted to a DLL and be used from b4p.
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)

My Posts helped you? Consider Buying me a Porto Glass!
Reply With Quote
  #5 (permalink)  
Old 09-09-2008, 12:39 PM
Senior Member
 
Join Date: Apr 2007
Location: Copenhagen
Posts: 173
Default

I think this works, after a fashion - there might be a better way of doing it...


Code:
Sub Globals
    
'Declare the global variables here.
End Sub

Sub App_Start
    frm1.Show

    lstbox1.Add(
"and let us start")  
    lstbox1.Add(
"first")
    lstbox1.Add(
"firstly")
    lstbox1.Add(
"firstlyfinal")
    lstbox1.Add(
"last")
End Sub


Sub TxtBox1_KeyPress (key)
    timer1.Enabled=
True     'essentially works like a key-up, choose a good interval
End Sub


Sub Timer1_Tick
    timer1.Enabled=
false
    
    txt=txtbox1.Text
    
For i=0 To lstbox1.Count-1
        
If StrIndexOf(lstbox1.Item(i),txt,0)=0 Then
            txtbox1.Text=lstbox1.Item(i)
            txtbox1.SelectionStart=StrLength(txt)
            txtbox1.SelectionLength=StrLength(lstbox1.Item(i))
            
Exit
        
End If
    
Next
End Sub
(doesn't work with backspace/delete at present though)

all the best / Björn

Last edited by BjornF : 09-09-2008 at 01:14 PM. Reason: Found a slightly better way of doing it
Reply With Quote
  #6 (permalink)  
Old 09-09-2008, 02:53 PM
Basic4ppc Veteran
 
Join Date: Feb 2008
Location: Hilversum, The Netherlands
Posts: 295
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by BjornF View Post
I think this works, after a fashion - there might be a better way of doing it...


Code:
...
(doesn't work with backspace/delete at present though)

all the best / Björn
Thats works pretty well actually... good job :-)
Reply With Quote
  #7 (permalink)  
Old 09-10-2008, 06:50 AM
Basic4ppc Veteran
 
Join Date: Sep 2008
Location: Brisbane, Australia
Posts: 317
Default the interval?

Looks good. What is the timer interval?

regards, Ricky
Reply With Quote
  #8 (permalink)  
Old 09-10-2008, 07:06 AM
Basic4ppc Veteran
 
Join Date: Sep 2008
Location: Brisbane, Australia
Posts: 317
Default Interval

I set the interval at 50ms. Works fine.

Now to figure out the backspace and delete issue....

thanks guys

Ricky
Reply With Quote
  #9 (permalink)  
Old 09-10-2008, 11:43 AM
Senior Member
 
Join Date: Apr 2007
Location: Copenhagen
Posts: 173
Default

New improved version
Now with support for backspace,
delete also seems to work after a fashion

Code:
Sub Globals
    
'Declare the global variables here.
    Dim Backspace
End Sub

Sub App_Start
    frm1.Show
    lstbox1.Add(
"and let us start")
    lstbox1.Add(
"first")
    lstbox1.Add(
"firstly")
    lstbox1.Add(
"firstlyfinal")
    lstbox1.Add(
"last")
End Sub


Sub TxtBox1_KeyPress (key)
    
If key=Chr(8Then
        Backspace=
True
    
Else
        Backspace=
False
    
End If
    timer1.Enabled=
True
End Sub

Sub Timer1_Tick
    timer1.Enabled=
false
    
    txt=txtbox1.Text
    
If Backspace AND StrLength(txt)>0 Then
        txt=SubString(txt,
0,StrLength(txt)-1)
    
End If
    
    
For i=0 To lstbox1.Count-1
        
If StrIndexOf(lstbox1.Item(i),txt,0)=0 Then
            txtbox1.Text=lstbox1.Item(i)
            txtbox1.SelectionStart=StrLength(txt)
            txtbox1.SelectionLength=StrLength(lstbox1.Item(i))
            
Exit
        
End If
    
Next
End Sub
all the best / Björn

Last edited by BjornF : 09-10-2008 at 03:17 PM. Reason: I've added "AND StrLength(txt)>0" to prevent error when deleting a one-character txt
Reply With Quote
  #10 (permalink)  
Old 09-11-2008, 06:03 AM
Basic4ppc Veteran
 
Join Date: Sep 2008
Location: Brisbane, Australia
Posts: 317
Default Thanks

That works great.

I have found the Del key doesn't fire the KeyPressed event.

It doesn't worry me much.

regards, Ricky

P.S I've changed my code to use a combobox and have the textbox cover the text part of the combobox, still showing the dropdown arrow.
On the combobox's SelectionChanged event I set the textbox's text to the item selected.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
AutoComplete combobox Ricky D Questions (Windows Mobile) 7 11-19-2008 07:45 AM
Case and AutoComplete control names agraham Beta Versions 1 09-18-2008 05:06 PM
Area Selection by combo boxes mozaharul Questions (Windows Mobile) 4 04-30-2008 04:36 AM
Clearing combo box value mozaharul Questions (Windows Mobile) 1 03-18-2008 08:10 AM
Can't set SelectedIndex of a combo box willisgt Questions (Windows Mobile) 12 09-21-2007 04:25 PM


All times are GMT. The time now is 02:16 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0