Hi Charles,
this little example is derived from examples/wingui/controls.o2bas. Due to my nicotine addiction it took 7 days to complete a code which would normally have been done in half an hour. But I see light at the end of the tunnel.
For creating the controls I applied variables in an array using expressions in square brackets. This works ok with the exception when calling a WinApi function like in case WM_SIZE, line 70 and line 71:
'MoveWindow (hchw[x + y*dimW], - will fail
MoveWindow (hchw(x + y*dimW),  - will work
Is it mandatory to apply parentheses when calling functions with array members? I do not know at the moment how this is treated with other languages.
Roland
$ filename "BtnCtrls.exe"
'uses RTL32
'uses RTL64
$ EscapeKeyEnd
uses WinUtil
int cx=60, cy=50 
MainWindow 10*cx+8, 5*cy+40, WS_OVERLAPPEDWINDOW
  
% dimW 10
% dimH  5
function WndProc(sys hwnd, uint uMsg, sys wParam, lParam) as sys callback
'================================================================
indexbase 0
static sys hchw[0x200]
static int id_flag[0x200]
sys id
int x,y
 
 
select uMsg 
 
  case WM_CREATE
     SetWindowText hwnd,"Controls"
     id = 0x100
     for y = 0 to < dimH
        for x = 0 to < dimW
           id ++          
           hchw[x + y*dimW] = CreateWindowEx(
                              0, 
                              "button", str(id), 
                              WS_CHILD | BS_TEXT | BS_PUSHBUTTON | WS_VISIBLE, 
                              'x*cx,y*cy,cx,cy,
                              0,0,0,0, 
                              hwnd, id, 
                              inst, null)
        next x
     next y                                
       
  case WM_COMMAND
     id = loword (wparam)
      
     if id>0x100 and id<0x200 then
       SetWindowText hWnd, "PushButton: " str id
       id_flag[id-0x101] = not id_flag[id-0x101]
       if id_flag[id-0x101] then
         SetWindowText hchw[id-0x101], hex(id)+"h"
       else
         SetWindowText hchw[id-0x101], str(id)
       end if                         
       SetFocus hwnd
     end if
  case WM_SIZE   // main window changed size  
     cx = loword (lParam) / dimW
     cy = hiword (lParam) / dimH
          
     for y = 0 to < dimH
        for x = 0 to < dimW
           'MoveWindow (hchw[x + y*dimW],
           MoveWindow (hchw(x + y*dimW),
                       x * cx, y * cy,
                       cx, cy, true) 
        next x
     next y                      
  case WM_DESTROY 
     PostQuitMessage 0 
  case else
     return DefWindowProc(hwnd, uMsg, wParam, lParam)
  end select
end function