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.

Selected item to top of ListBox

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-15-2008, 07:13 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Netherlands
Posts: 222
Default Selected item to top of ListBox

Hi,

In a program I have a ListBox with many items. I want to help the user in scrolling as I know roughly which item he will need. I managed to select programmatically that item. It appears at the bottom of the ListBox. Does somebody know a possibility to get programmatically that selected item on the top of the list?

Harry
Reply With Quote
  #2 (permalink)  
Old 12-15-2008, 07:18 PM
taximania's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire. UK
Posts: 592
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Can't you use the index and a temp variable to swap the two.

Sorry for the short reply. I didn't have time to test what I said
__________________
.
.
.
Don't ask, I'm fine, honest. !!
.
.
.
Just a little crazy at times



O2 XDA, GW Evo 2.1 UC WWE Rom, WM6.1
Radio Ver 03.34.90
With Basic4ppc V6.80


http://www.taximania.co.uk
Reply With Quote
  #3 (permalink)  
Old 12-15-2008, 07:19 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

That's a thought one...
If you DO know what the probable choice is, then delete the item from the list box, and then add ity again to the first position....
listbox.additem(0)="myItem"
__________________
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
  #4 (permalink)  
Old 12-16-2008, 04:49 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

As Cableguy wrote you should remove the item with ListBox.Remove or ListBox.RemoveAt and then add it with ListBox.Insert(0,"some value").
Reply With Quote
  #5 (permalink)  
Old 12-19-2008, 08:35 AM
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Netherlands
Posts: 222
Default Re:Selected item to top of ListBox

Hi,

Thanks for your suggestions. However, as the list is in alphabetic sequence, I cannot move items to another place. I found myself the following solution:

Find the index of the probable candidate
Add to it the number of visible items -1
Check on the Count and correct if necessary
Select the raised index
Select the original index

Using Visible is false and true around this operation gives an acceptable performance (as it does with various Table operations).

Harry
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
Treeview - getting the selected branch blackbox Questions (Windows Mobile) 4 12-05-2009 10:35 PM
Settings for User's selected 'theme' willisgt Questions (Windows Mobile) 2 02-21-2008 04:06 PM
How catch a selected treeview item information by mouse ? dan kabestan Questions (Windows Mobile) 2 01-08-2008 06:30 PM
add menu item at runtime? bob Questions (Windows Mobile) 1 11-20-2007 11:05 AM
Tablecell 0 not selected Scubaticus Bug Reports 4 07-30-2007 09:03 PM


All times are GMT. The time now is 03:29 AM.


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