Page 1 of 1

set listviewgadget text entry without scrolling (windows)

Posted: Sat Jun 19, 2004 2:33 pm
by blueznl
Code updated for 5.20+

loads of sweat before i found out what 'autoscrolled' (ahum) my (changing) listviewgadgets...

solution is easy:

Code: Select all

Procedure x_setlistviewitemtext(gadgetnr,itemnr,text.s)
  Protected t, gadget_h
  ;
  ; *** set specific item of a listview gadget to a new text
  ;
  ; in:             gadgetnr - gadgetid
  ; retval:                  - none
  ; out:                     - none
  ;
  ; note:
  ;
  ; - listviewgadget only
  ; - as setgadgetitemtext however does not scroll up or down
  ;
  ; listviewgadgets can scroll up / down when overwriting an entry (this is due to the behaviour of the
  ; gadget under windows, where an entry is replaced by first sending a delete message causing the scroll,
  ; followed by an insert item message)
  ;
  gadget_h = GadgetID(gadgetnr)
  t = SendMessage_(gadget_h,#LB_GETTOPINDEX,0,0)
  SendMessage_(gadget_h,#WM_SETREDRAW,#False,0)
  SetGadgetItemText(gadgetnr,itemnr,text,0)
  SendMessage_(gadget_h,#LB_SETTOPINDEX,t,0)
  SendMessage_(gadget_h,#WM_SETREDRAW,#True,0)
EndProcedure
this also minimizes 'flicker', though only without the last line in sight (don't ask me why, windows....)