New topic: Listbox help needed
<http://forums.realsoftware.com/viewtopic.php?t=45281> Page 1 of 1 [ 4 posts ] Previous topic | Next topic Author Message jerryab Post subject: Listbox help neededPosted: Fri Sep 07, 2012 9:22 am Joined: Mon Dec 12, 2011 7:25 pm Posts: 88 Location: Grand Rapids MI Area I am using this routine on a list box and it works fine if the column is Zero I need it to work on column 1. Can someone help me with this. This code works ok on column 0 dim i as integer // If arrow keys are pressed then bypass the letter keys If Keyboard.AsyncKeyDown(125) or Keyboard.AsyncKeyDown(126) then //Do nothing and allow letter keys else if(ticks-lastKeyPressedAt<30) then lastkeyPressed=lastkeyPressed+key else lastkeyPressed=key end if lastKeyPressedAt=ticks listIndex=-1 for i = 0 to listcount-1 if(lowercase(left(list(i),len(lastKeyPressed)))=Lowercase(lastKeyPressed)) then listindex=i exit end if next End If I tried this line to make it work on column 1 but it did not work. if(lowercase(left(list.Cell(list(i), 1),len(lastKeyPressed)))=Lowercase(lastKeyPressed)) then _________________ iMac 27" (2.8GHz Intel Core i5, 16GB RAM, 1TB Drive) OS X Lion 10.7.3 Toshiba Laptop Running Windows 7 & WinXP SP3 REAL Studio Enterprise Edition 2011r4.3 http://www.theultimatecampgroundlog.com Being rewritten for the Mac Top Markus Winter Post subject: Re: Listbox help neededPosted: Fri Sep 07, 2012 9:27 am Joined: Sun Feb 19, 2006 4:00 pm Posts: 1173 Location: Heidelberg, Germany What is the routine supposed to do and where have you put it in? Because right now what you are saying is: "Here is some code somewhere in my app which isn't doing what I want so go ahead and figure out what it is doing and guess what I really want it to do ... please." Not the best way to get help. Top jerryab Post subject: Re: Listbox help neededPosted: Fri Sep 07, 2012 9:41 am Joined: Mon Dec 12, 2011 7:25 pm Posts: 88 Location: Grand Rapids MI Area Its for a listbox, when you type a letter it is supposed to go to an item in the listbox by the letter pressed. Like I said it works fine on column zerro but I need it to check column 1 I got the code from the manual. http://docs.realsoftware.com/index.php/RectControl.KeyDown _________________ iMac 27" (2.8GHz Intel Core i5, 16GB RAM, 1TB Drive) OS X Lion 10.7.3 Toshiba Laptop Running Windows 7 & WinXP SP3 REAL Studio Enterprise Edition 2011r4.3 http://www.theultimatecampgroundlog.com Being rewritten for the Mac Top jakuno Post subject: Re: Listbox help neededPosted: Fri Sep 07, 2012 11:12 am Joined: Fri Aug 31, 2012 3:56 pm Posts: 3 Use me.Cell(i, 1) instead of me.List(i) Dim i As Integer If (ticks-lastKeyPressedAt < 30) Then lastkeyPressed = lastkeyPressed + key Else lastkeyPressed = key End If lastKeyPressedAt = ticks me.ListIndex = -1 For i = 0 To me.ListCount-1 dim s as string = me.Cell(i, 1) If (Lowercase(Left(s, Len(lastKeyPressed))) = Lowercase(lastKeyPressed)) Then me.listindex = i Exit For End If Next Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 4 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml rbforumnotifier@monkeybreadsoftware.de