Page 1 of 1

PB4 Mac B1: ListviewGadget not supportet?

Posted: Fri May 25, 2007 9:23 pm
by michel51
If I run the following code, the Gadget numbers of the buttons are shown in the debugger.

Code: Select all

;- Window Constants
;
Enumeration
  #Window_0
EndEnumeration

;- Gadget Constants
;
Enumeration
  #Button_0
  #Button_1
  #Button_2
  #Button_3
  #Listview_0
EndEnumeration

Procedure Open_Window_0()
  If OpenWindow(#Window_0, 358, 178, 300, 300, "Gadget Test",  #PB_Window_SizeGadget | #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered )
    If CreateGadgetList(WindowID(#Window_0))
      ButtonGadget(#Button_0, 5, 5, 70, 25, "Button0")
      ButtonGadget(#Button_1, 225, 5,70, 25, "Button1")
      ButtonGadget(#Button_2, 5, 270, 70, 25, "Button2")
      ButtonGadget(#Button_3, 225, 270, 70, 25, "Button3")
      ListViewGadget(#Listview_0, 55, 30, 190, 240)     
    EndIf
  EndIf
EndProcedure

Open_Window_0()

Repeat
 
  Event = WaitWindowEvent()

  If Event = #PB_Event_Gadget
   
    GadgetID = EventGadget()
   
    If GadgetID = #Button_0
      Debug "GadgetID: #Button_0"
     
    ElseIf GadgetID = #Button_1
      Debug "GadgetID: #Button_1"
     
    ElseIf GadgetID = #Button_2
      Debug "GadgetID: #Button_2"
     
    ElseIf GadgetID = #Button_3
      Debug "GadgetID: #Button_3"
     
    ElseIf GadgetID = #Listview_0   
      Debug "GadgetID: #Listview_0" ; <--- one does not display
     
    EndIf
   
  EndIf
 
Until Event = #PB_Event_CloseWindow

End
;
But if I click the listviewgadget, it will be selected, but the debug output not occurs. It seems, that there is no EventGadget() for ListviewGadget.
Is this a bug or is the code wrong?

Try adding an item

Posted: Wed May 30, 2007 11:30 pm
by manu
The events
#PB_EventType_LeftClick
#PB_EventType_LeftDoubleClick
of a ListViewGadget are only fired if you click on an item of the gadget.
Since your ListViewGadget is empty, no events are created.
Try to add the line

Code: Select all

AddGadgetItem(#Listview_0, -1, "My first ListView Item")
after the ListViewGadget call. Then click on the item, not the empty space.
I didn't try it on MAC though...
Does this fix your problem?

--manu

Re: Try adding an item

Posted: Thu May 31, 2007 5:16 pm
by michel51
manu wrote:The events
#PB_EventType_LeftClick
#PB_EventType_LeftDoubleClick
of a ListViewGadget are only fired if you click on an item of the gadget.
Since your ListViewGadget is empty, no events are created.
Try to add the line

Code: Select all

AddGadgetItem(#Listview_0, -1, "My first ListView Item")
after the ListViewGadget call. Then click on the item, not the empty space.
I didn't try it on MAC though...
Does this fix your problem?

--manu
Yes, the ListViewGadget number is shown, if I click on the added item.
Thanks, manu.