IonicWind Software

IWBasic => General Questions => Topic started by: Brian on January 22, 2012, 12:23:12 PM

Title: LVFINDITEM
Post by: Brian on January 22, 2012, 12:23:12 PM
Hi,

Could anyone sort this code out for me, please? I really don't understand it (Sapero again!)

http://www.ionicwind.com/forums/index.php?topic=789.msg6989#msg6989

I need it to work in IWB. I have a listview in a dialog window called dView, and the listview
has the ID of 1

Would be great if I could get it working. Can't post the whole of the code, as the data
is covered by the Data Protection Act here

Many thanks,

Brian

Title: Re: LVFINDITEM
Post by: LarryMc on January 22, 2012, 02:27:54 PM
From the help file:
Quoteposition = CONTROLCMD( window | dialog, ID, @LVFINDITEM, text$)

Searches for an item. Returns the zero-based index of the item or -1 if the item could not be found.

text$ is the case sensitive string to search for.

so:
string text$="findme"
int index = CONTROLCMD(dView, 1, @LVFINDITEM, text$)
if index <>-1
   CONTROLCMD(dView, 1, @LVSETSELECTED, index)
endif


LarryMc
Title: Re: LVFINDITEM
Post by: Brian on January 23, 2012, 12:28:56 PM
Larry,

Thanks for your input. I'm working on it at the moment, but it doesn't appear to be
doing much - just hangs the listview up

Time to have a cup of tea!

Brian
Title: Re: LVFINDITEM
Post by: Brian on January 24, 2012, 01:06:05 PM
Larry,

Am I missing something here? Do I have to loop through the listview items for
LVFINDITEM to work? Surely it can't just iterate through the items on its own?

Brian
Title: Re: LVFINDITEM
Post by: LarryMc on January 24, 2012, 01:09:29 PM
Yes, I does go through the items in the listview looking  for the exact match.

I looks for the ITEMS and not the rest of the columns that may be present.

LarryMc
Title: Re: LVFINDITEM
Post by: Brian on January 24, 2012, 01:13:24 PM
Larry,

Sorry if I'm being a bit thick tonight - but what exactly do you mean by ITEM ?

If you can't look for a string in any of the rows, what's the point?

Brian
Title: Re: LVFINDITEM
Post by: LarryMc on January 24, 2012, 01:17:37 PM
it searches all the ROWS but only in the first COLUMN.

If you want to search the other COLUMNs then you'll have to search through the ROWS yourself.

LarryMc
Title: Re: LVFINDITEM
Post by: Brian on January 24, 2012, 01:24:55 PM
Right - gotcha. Works now...

Brian