PB Beginner - a few questions
Posted: Mon Aug 10, 2020 3:07 pm
Hi,
I come form a c/c++ background but have always loved tinkering in basic.
Firstly when I define an array:
Dim MyArray.i(10)
does the array follow C - 0-9 or like VB6 1-10. i.e
MyArray(0) = 100 or MyArray(1) = 100
Also my first attempt was to create an array of gadgets like so:
Dim Canvas_Gadgets.i(10)
For i = 1 To 10
Canvas_Gadgets(i) = CanvasGadget(#PB_Any, i*220, ImageHeight(0)/2, 320, 200, #PB_Canvas_Container)
Next i
BindEvent(#PB_Event_SizeWindow, @OnWindowResize(), 0)
....
; here's where I get the error -Line 19: Canvas_Gadgets() is not a function, array, list, map or macro. (line 19 is ResizeGadget)
Procedure OnWindowResize()
For i = 1 To 10
;line 19
ResizeGadget(Canvas_Gadgets(i), #PB_Ignore, WindowHeight(0)/2, #PB_Ignore, #PB_Ignore)
Next i
EndProcedure
I come form a c/c++ background but have always loved tinkering in basic.
Firstly when I define an array:
Dim MyArray.i(10)
does the array follow C - 0-9 or like VB6 1-10. i.e
MyArray(0) = 100 or MyArray(1) = 100
Also my first attempt was to create an array of gadgets like so:
Dim Canvas_Gadgets.i(10)
For i = 1 To 10
Canvas_Gadgets(i) = CanvasGadget(#PB_Any, i*220, ImageHeight(0)/2, 320, 200, #PB_Canvas_Container)
Next i
BindEvent(#PB_Event_SizeWindow, @OnWindowResize(), 0)
....
; here's where I get the error -Line 19: Canvas_Gadgets() is not a function, array, list, map or macro. (line 19 is ResizeGadget)
Procedure OnWindowResize()
For i = 1 To 10
;line 19
ResizeGadget(Canvas_Gadgets(i), #PB_Ignore, WindowHeight(0)/2, #PB_Ignore, #PB_Ignore)
Next i
EndProcedure