Topic: Using element IDs
I need to use an ID to use commands with the gui elements. When I get an ID and try to use a command with it, bmax says the command does not exist.
I wanted to have a grid of images and change them as the scrollbar changes.
Here's my code.
'Inventory Window
Local Inventory:IGUIWindow = Gui.addWindow(..
_RECTI(100 + CNT, 100 + CNT, 400 + CNT, 532 + CNT), ..
False, ..
"Inventory", Null, 700)
'Inventory List
Local Row
For Row = 1 To 5
Local Col
For Col = 1 To 4
If (InventoryArray[InvTab.getActiveTab()].length = Row + Col)
Gui.addImageFromTexture(..
Video.getTexture("Media/InvItem.tga"), ..
_POSITION2DI(8 + ((Col - 1) * 64), 64 + 8 + ((Row - 1) * 64)), ..
True, ..
Gui.getRootGUIElement().getElementFromId(700), ..
703 + Row + Col, ..
InventoryArray[InvTab.getActiveTab()][Row + Col])
Else
Gui.addImageFromTexture(..
Video.getTexture("Media/InvItem.tga"), ..
_POSITION2DI(8 + ((Col - 1) * 64), 64 + 8 + ((Row - 1) * 64)), ..
True, ..
Gui.getRootGUIElement().getElementFromId(700), ..
703 + Row + Col, ..
"Empty")
End If
Next
Next
'Iventory Scroll Bar
Local InvScroll:IGUIScrollBar = Gui.addScrollBar(False, _RECTI(272, 16 + 64, 292, 360), Inventory, 702)
'Scrolling
If (id = 702 and Gui.getRootGUIElement().getElementFromId(700).isValid() = True)
Local Row
For Row = 1 To 5
Local Col
For Col = 1 To 4
Local InvItem:IGUIElement = InvItem = Gui.getRootGUIElement().getElementFromId(703 + Row + Col)
If (0 = Row + Col)
InvItem.setText("Used")
InvItem.setImage("Media/EllipseInfo.tga")
Else
InvItem.setText("Empty")
InvItem.setImage("Media/InvItem.tga")
End If
Next
Next
End If