Page 1 of 1

PB Docs: ListViewGadget multiselect demo prog

Posted: Thu Dec 31, 2015 6:48 am
by collectordave
After seeing one newbie question how to use the multiselect feature of a ListViewGadget i would like to suggest that the following example be included in the docs somewhere to demonstrate as after a quick search I could not find an example.

Code: Select all

Global Window_0

Global lstSelection, lstDisplay, btnCopy

  Window_0 = OpenWindow(#PB_Any, x, y, 390, 280, "List View Multiselect", #PB_Window_SystemMenu)
  lstSelection = ListViewGadget(#PB_Any, 20, 10, 140, 240, #PB_ListView_MultiSelect)
  lstDisplay = ListViewGadget(#PB_Any, 230, 10, 140, 240)
  btnCopy = ButtonGadget(#PB_Any, 170, 70, 50, 20, "Copy")

  ;Add Items to lstSelection
  For i = 1 To 10
    AddGadgetItem(lstSelection,-1,"Item " + Str(i))
  Next i

  Repeat
    
    event = WaitWindowEvent()

  Select event

    Case #PB_Event_Gadget
      Select EventGadget()
        Case btnCopy
          ;Clear display list
          ClearGadgetItems(lstDisplay)
          ;Copy selected items to display list
          For i = 0 To 9
            If GetGadgetItemState(lstSelection,i) = 1
              AddGadgetItem(lstDisplay,-1,GetGadgetItemText(lstSelection,i))
            EndIf
          Next i
          
      EndSelect
      
  EndSelect
  
  Until event = #PB_Event_CloseWindow
The program displays two list views. The left hand side being multiselect. After selecting some items clicking the button copies the selected items to the right hand side listView.

Re: PB Docs: ListViewGadget multiselect demo prog

Posted: Mon Jan 04, 2016 10:42 pm
by WilliamL
Maybe this should be in 'Bugs-Documentation'?

Re: PB Docs: ListViewGadget multiselect demo prog

Posted: Wed Jan 06, 2016 5:31 am
by collectordave
Not a bug.

There seems to be a few posts from this topic missing?

Re: PB Docs: ListViewGadget multiselect demo prog

Posted: Wed Jan 06, 2016 6:07 am
by WilliamL
I agree that it is not a bug but I found, when I made a suggestion on the Docs thread, that it got a response from the people who wrote the Docs. :wink: