Creating a grid of controls

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

Creating a grid of controls

Post by guest » Mon Apr 09, 2018 2:23 pm

(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 #win.st, 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.st, "#win.statictext";row
    maphandle #win.tb1, "#win.leftbox";row
    maphandle #win.tb2, "#win.rightbox";row
  next
  WindowWidth = 600
  open "Looped controls" for window as #win
  wait
The code creates this window:

Image

Richard.

Post Reply