I'm at the very early stage of learning PureBasic. I'm expecting that ultimately my main interest will be in using the database functions and with this in mind I experimented with the ListIconGadget. I was expecting a single row to be added to the ListIconGadget when I click the button in my little program below but when I run the program, a button click causes three rows to be added and then two rows for each click thereafter. I must be doing something very silly.
I'm running PureBasic 6.00 LTS (Windows - x64) on Windows 10 Pro 64 bit.
Can someone tell me what I'm doing wrong please.
Thanks in advance
Code: Select all
myWindow = OpenWindow(#PB_Any, 10, 10, 640, 480, "Test")
btnAddLine = ButtonGadget(#PB_Any, 20, 20, 100, 50, "Add Item")
myListIconGadget = ListIconGadget(#PB_Any, 20, 90, 600, 370, "My Data", 600)
btnExit = ButtonGadget(#PB_Any, 520, 20, 100, 50, "Exit")
Repeat
event = WaitWindowEvent()
If #PB_Event_Gadget
gadget = EventGadget()
If gadget = btnAddLine
AddGadgetItem(myListIconGadget, -1, "Hello")
EndIf
If gadget = btnExit
event = #PB_Event_CloseWindow
EndIf
EndIf
Until event = #PB_Event_CloseWindow