You have declared your variable inside the while block. So it�s not
avaible outside of this block. You should put the declaration after
your other declaration and before your while block.

cya
----- Original Message -----
From: "R�gis Daniel de Oliveira" <[EMAIL PROTECTED]>
Newsgroups: palm-dev-forum
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Thursday, January 16, 2003 8:35 PM
Subject: Compilation Error... Why?


> Hy all!!!
>
> I'm using this function the find a  item in a list. When I put the last
> 'LstSetSelection(lptr,iItemMid);', the compiler says :
>
> frmRCAS.c: In function `FindItemList':
> frmRCAS.c:336: `iItemMid' undeclared (first use in this function)
> frmRCAS.c:336: (Each undeclared identifier is reported only once
> frmRCAS.c:336: for each function it appears in.)
> make: *** [Debug/frmRCAS.o] Error 1
>
>
> Does anybody know why?
>
>
> Thanks a lot again!!!
>
>
>
> void FindItemList(Char* Texto)
> {
>
> FormPtr form = FrmGetActiveForm();
> ListPtr lptr = (ListPtr)FrmGetObjectPtr(form, FrmGetObjectIndex(form,
> lstRCAS));
>
> int iItem = -1;
> int iItemStart = 0;
> int iItemStop = LstGetNumberOfItems(lptr);
> char ItemStr[30];
> Int16 sgn;
>
>
>  while (iItemStop > iItemStart)
>  {
>
>  int iItemMid = (iItemStart + iItemStop) /2;
>
>  //Pega o conte�do do item na lista
>
>  Char * ItemStr = LstGetSelectionText(lptr,iItemMid);
>
>
>
>  sgn = StrNCaselessCompare(ItemStr,Texto,StrLen(Texto));
>   if (sgn < 0)
>   iItemStart = iItemMid + 1;
>   else
>   {
>    if (sgn == 0)
>    iItem = iItemMid; //Remember...
>    iItemStop = iItemMid;
>
>   }
>  }
>
>     if (iItem >= 0)
>     //scroll to item
>  LstSetSelection(lptr,iItemMid);
>
>
>
> }
>
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
>
>


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to