Hi all,
I'm trying to make a simple GUI using multiple PictureBoxes, but I'm confused about how they're supposed to work. I can't tell if I've found a bug in the Lua wrappers or I just don't understand their implementation.
Suppose I have code like this:
Language: lua
local main_form = forms.newform(100, 300)
local box1 = forms.pictureBox(main_form, 0, 0, 100, 100)
-- This draws in box1 as expected
forms.drawText(box1, 0, 0, '1')
local box2 = forms.pictureBox(main_form, 0, 100, 100, 100)
-- I only want to draw in box2 here, but it draws in both box1 and box2
forms.drawText(box2, 20, 0, '2')
local box3 = forms.pictureBox(main_form, 0, 200, 100, 100)
-- And now it draws in box1, box2 and box3
forms.drawText(box3, 40, 0, '3')
-- Even with an invalid handle, it draws in box1, box2 and box3
forms.drawText(0, 60, 0, '4')
It seems that drawText() (as well as drawImage(), drawRectangle(), clear(), etc.) will always draw in all PictureBox instances in existence when it's called. I even tried associating the PictureBoxes with separate parent forms, but it didn't make a difference.
Is this intentional? Is there any way to have two PictureBoxes that can be drawn in independently?