PB4 Mac B1: ListviewGadget not supportet?

Just starting out? Need help? Post your questions and find answers here.
User avatar
michel51
Enthusiast
Enthusiast
Posts: 290
Joined: Mon Nov 21, 2005 10:21 pm
Location: Germany

PB4 Mac B1: ListviewGadget not supportet?

Post 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?
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.21(x64), V 5.22beta
User avatar
manu
User
User
Posts: 32
Joined: Tue May 13, 2003 12:40 pm
Location: Germany
Contact:

Try adding an item

Post 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
User avatar
michel51
Enthusiast
Enthusiast
Posts: 290
Joined: Mon Nov 21, 2005 10:21 pm
Location: Germany

Re: Try adding an item

Post 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.
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.21(x64), V 5.22beta
Post Reply