For, While and Repeat
Posted: Thu Dec 31, 2015 2:11 pm
Hi,
Can anyone tell me why this is not working in version 1.10. It was working in 1.02. Is it a bug?
The loop within the SelectAllDocs and DeSelectAllDocs procedures don't get past the first iteration.
I have tried a for loop, while loop and repeat loop. They all have the same result.
Can anyone tell me why this is not working in version 1.10. It was working in 1.02. Is it a bug?
The loop within the SelectAllDocs and DeSelectAllDocs procedures don't get past the first iteration.
I have tried a for loop, while loop and repeat loop. They all have the same result.
Code: Select all
Procedure SelectAllDocs()
Debug "Count of items: " + Str(CountGadgetItems(1))
x = CountGadgetItems(1)
For k = 0 To x - 1
Debug "Loop: " + Str(k)
SetGadgetItemState(1,k,#PB_ListIcon_Checked)
Next
EndProcedure
Procedure DeSelectAllDocs()
Debug "Count of items: " + Str(CountGadgetItems(1))
x = CountGadgetItems(1)
For k = 0 To CountGadgetItems(1) - 1
Debug "Loop: " + Str(k)
SetGadgetItemState(1,k,0)
Next
EndProcedure
Procedure GadgetEvent()
GadgetID=EventGadget()
Select GadgetID
Case 2
SelectAllDocs()
Case 3
DeSelectAllDocs()
EndSelect
EndProcedure
; Shows possible flags of ListIconGadget in action...
If OpenWindow(0, 0, 0, 640, 300, "ListIconGadgets", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
; left column
TextGadget (0, 300, 10, 300, 20, "ListIcon with Checkbox", #PB_Text_Center)
ListIconGadget(1, 10, 20, 620, 230, "Column 1", 100, #PB_ListIcon_CheckBoxes) ; ListIcon with checkbox
For b = 2 To 4 ; add 3 more columns to each listicon
AddGadgetColumn(1, b, "Column " + Str(b), 100)
Next
For b = 0 To 7 ; add 4 items to each line of the listicons
AddGadgetItem(1, b, "Item 1"+Chr(10)+"Item 2"+Chr(10)+"Item 3"+Chr(10)+"Item 4")
Next
ButtonGadget(2, 10, 260, 100, 20, "Select All")
ButtonGadget(3, 130, 260, 100, 20, "DeSelect All")
BindEvent(#PB_Event_Gadget,@GadgetEvent())
EndIf