Thread: GTListView
View Single Post
Old 21 February 2021, 11:50   #6
Registered User

Join Date: Jan 2021
Location: UK
Posts: 25
[QUOTE=Daedalus;1463288]Here's a working example, but bear in mind that you need to do a GTChangeList command to detach and reattach the list to the listview whenever you change the list, otherwise bad things will happen. Also, this is AmiBlitz3 code, if you're compiling under Blitz 2.1, I think you need to set a finite limit on the size of a List array, which limits how many entries you can display.

WbToScreen 0

NEWTYPE .listitem

Dim List MyListItems.listitem(0)

For i.w = 1 To 50
  If AddItem(MyListItems())
    MyListItems()\itemname = "Entry " + Str$(i)
  End If
Next i

GTNewLookProp On ; Gives the nicer looking sliders

GTTags #GTLV_ShowSelected, 0 ; Leaves the selected bar on the last clicked entry

GTListView 0, 0, 10, 10, 150, 150, "List Options", #PLACETEXT_BELOW, MyListItems()

Window 0, 200, 200, 200, 200, #WFLG_DRAGBAR|#WFLG_CLOSEGADGET|#WFLG_DEPTHGADGET, "Test", 0, 1

AttachGTList 0, 0


  ev.l = WaitEvent
  If ev
    NPrint "Event: ", Hex$(ev)
      If GadgetHit = 0
        NPrint "Listview hit: ", EventCode
      End If
    End If
  End If

Hi Daedalus,

I've just put this code into BB 2.1 which I've got and it's come up with an error against the line ... GTNewLookProp On

It says "Garbage at end of Line" as it doesn't recognise the command GTNewLookProp so it thinks the command is On. I've had a look at the BB manual and I can't see that instruction as part of the list unfortunately.

If I put a semicolon in front of the command it then doesn't like the line GTTags #GTLV_ShowSelected, 0 The error message for that one is "Constant Not Found".

Any ideas mate?

JJ__ is offline  
Page generated in 0.05031 seconds with 11 queries