Creating a grid of controls

Discussions related to the extensions to the language available in LBB
Site Admin
Posts: 193
Joined: Tue Apr 03, 2018 1:34 pm

Creating a grid of controls

Post by guest »

(copied from the old forum)

In LB 4.04 and 4.51 it is not possible to create a grid of child controls using a loop; every control must be created individually, and with a large grid that can mean a lot of code! In LBB it is straightforward using MAPHANDLE:

Code: Select all

  for row = 1 to 13
    statictext, str$(row), 95, 18 + row*20, 18, 20
    textbox #win.tb1, 115, 12 + row*20, 350, 25
    textbox #win.tb2, 461, 12 + row*20, 40, 25
    stylebits #win.tb2, _ES_RIGHT, 0, 0, 0
    maphandle, "#win.statictext";row
    maphandle #win.tb1, "#win.leftbox";row
    maphandle #win.tb2, "#win.rightbox";row
  WindowWidth = 600
  open "Looped controls" for window as #win
The code creates this window: