October 30, 2025, 05:32:33 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


LVFINDITEM

Started by Brian, January 22, 2012, 12:23:12 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Brian

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


LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Brian

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

Brian

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

LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Brian

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

LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Brian

Right - gotcha. Works now...

Brian