Page 1 of 1

Posted: Mon Aug 12, 2002 1:54 pm
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.

SetGadgetItemState doesn't highlight after a SendMessage_ to the object for some reason...

Code: Select all

Procedure FindFirst(Parameter)

  If CountGadgetItems(#ListBox) = 0 
    StatusBarText(#MyStatusBar, 0, "There is no data loaded or in the list to work on!", 0)
    ProcedureReturn
  EndIf
  
  founddata = 0
  
  other()\finditem = LCase(GetGadgetText(#FindItem))
  
  If other()\finditem  ""
    ResetList(content())
    While NextElement(content()) And founddata  1
      compare.s = LCase(content()\filename + content()\filetype + content()\category + content()\collection + content()\display + content()\trademark + content()\tradelink)
      If FindString(compare.s, other()\finditem, 1)  0
        founddata = 1
        itemnumber = ListIndex(content())
        SendMessage_(GadgetID(#ListBox), #LVM_ENSUREVISIBLE, itemnumber - 1, 0)
        SetGadgetItemState(#ListBox, itemnumber - 1, 1)
        other()\liststate = itemnumber - 1
      EndIf
    Wend
   Else
     StatusBarText(#MyStatusBar, 0, "Nothing to find, You actually have To put something in the search box To find anything?", 0)
  EndIf

EndProcedure
For some reason, the SendMessage_ makes the right item visible if below the window line (I have checked that it is found) but SetGadgetItemState does not highlight the item, neither does SetGadgetState. Has that API command somehow blasted the focus away and is there anything I can do about it?

I have tried ActivateGadget but it made no difference. #ListBox is the ListIconGadget

Fangles