Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sun Aug 20, 2017 9:55 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: ListBox
PostPosted: Sat Mar 09, 2013 4:20 pm 
Offline
User avatar

Joined: Wed Sep 20, 2006 5:12 pm
Posts: 680
Location: Puerto Rico
Is any ListBox more faste
The RS listbox is no to fast

_________________
Thanks for any contribution and God blesses all (I start Using RS in 10/12/2010)
Mac Mini with Lion v10.7.5 and Real Studio 2012r1 Pro And Windows 7 RS2012r1 Personal and Linux RS2012r1 Personal Register user
my Hobbies R/C Turbines Jets Models


Top
 Profile  
Reply with quote  
 Post subject: Re: ListBox
PostPosted: Sat Mar 09, 2013 4:27 pm 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
set visible to false while changing a lot to avoid redraws.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: ListBox
PostPosted: Sat Mar 09, 2013 7:21 pm 
Offline
User avatar

Joined: Wed Sep 20, 2006 5:12 pm
Posts: 680
Location: Puerto Rico
i am using this code

Dim i, c As Integer


if RbItems.Value = True Then
for i = 0 to ListBox1.ListCount -1
//for c = 0 to ListBox1.ColumnCount - 1
if InStr(ListBox1.Cell(i,1), TxtSearch.Text) <> 0 then // different from 0
''ListBox1.CellBold(i,1) = true // make the text bold
ListBox1.InvalidateCell(i,1)
ListBox1.ListIndex=i
else
ListBox1.CellBold(i,c) = false
end if
//next
next
Else
for i = 0 to ListBox1.ListCount -1
//for c = 0 to ListBox1.ColumnCount - 1
if InStr(ListBox1.Cell(i,0), TxtSearch.Text) <> 0 then // different from 0
'ListBox1.CellBold(i,0) = true // make the text bold
ListBox1.InvalidateCell(i,1)
ListBox1.ListIndex=i
else
ListBox1.CellBold(i,c) = false
end if
//next
next

end if

for search but is slow

_________________
Thanks for any contribution and God blesses all (I start Using RS in 10/12/2010)
Mac Mini with Lion v10.7.5 and Real Studio 2012r1 Pro And Windows 7 RS2012r1 Personal and Linux RS2012r1 Personal Register user
my Hobbies R/C Turbines Jets Models


Top
 Profile  
Reply with quote  
 Post subject: Re: ListBox
PostPosted: Sun Mar 10, 2013 5:53 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
you should leave loop with exit command when you are done.
Also I don't think you need to call InvalidateCell explicit.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: ListBox
PostPosted: Sun Mar 10, 2013 11:10 am 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
see here http://forums.realsoftware.com/viewtopic.php?f=1&t=47239

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: ListBox
PostPosted: Sun Mar 10, 2013 12:29 pm 
Offline
User avatar

Joined: Wed Sep 20, 2006 5:12 pm
Posts: 680
Location: Puerto Rico
hi Dave

this no works.

example

if i am looking for ZERO and i have a record with COLA ZERO it never found ZERO
:?:

_________________
Thanks for any contribution and God blesses all (I start Using RS in 10/12/2010)
Mac Mini with Lion v10.7.5 and Real Studio 2012r1 Pro And Windows 7 RS2012r1 Personal and Linux RS2012r1 Personal Register user
my Hobbies R/C Turbines Jets Models


Top
 Profile  
Reply with quote  
 Post subject: Re: ListBox
PostPosted: Sun Mar 10, 2013 12:36 pm 
Offline
User avatar

Joined: Wed Sep 20, 2006 5:12 pm
Posts: 680
Location: Puerto Rico
Hi Dave i change you code like this and now works perfect
Thanks


Dim search1 As String


if len(TxtSearch.Text)=0 then
listbox1.listindex=-1
else
dim value As String = TxtSearch.Text
Dim I As Integer
dim FoundAt As Integer = -1
FoundAt = -1
for i = 0 to listbox1.ListCount-1
search1=Mid(listbox1.cell(i,0),1,Len(TxtSearch.Text.Trim))
if instr(search1,value) > 0 then
FoundAt = i
exit
end
next
if FoundAt >= 0 then
listbox1.ListIndex = FoundAt
ListBox1.InvalidateCell(i,0)
else
listbox1.listindex=-1
end if
end if

_________________
Thanks for any contribution and God blesses all (I start Using RS in 10/12/2010)
Mac Mini with Lion v10.7.5 and Real Studio 2012r1 Pro And Windows 7 RS2012r1 Personal and Linux RS2012r1 Personal Register user
my Hobbies R/C Turbines Jets Models


Top
 Profile  
Reply with quote  
 Post subject: Re: ListBox
PostPosted: Sun Mar 10, 2013 1:58 pm 
Offline
User avatar

Joined: Sun Jan 25, 2009 5:11 pm
Posts: 576
Location: Guatemala, Central America
Hi,

First of all try to use the insert code tags, makes reading code much easier.

I was looking at your code and noticed a lot of variables being assigned for no good reason. I just typed a bit of code that perhaps could help you.

dim s as string = TextField1.text.trim // Valor a buscar

// Existe algo que buscar y la lista tiene items?
if listbox1.ListCount = 0 then
exit
end if
if s.len = 0 then
listbox1.ListIndex = -1
exit
end if

dim i as integer
for i = 0 to (listbox1.ListCount -1)
if InStr(0, listbox1.Cell(i,0), s) > 0 then
listbox1.ListIndex = i
exit for i // Se encontro lo que se buscaba, ahora hay que salir
end if
next i


Personally I would move the code to a method, I don't like placing code in any action events, what I do is either call a function or a method from the action event, this allows you to call your function from somewhere else in your code if needed.

_________________
Future RS guru.
Ride the world!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


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

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group