Sub CreateButtons
Dim btnMenu(120) As Button
Dim TopStart As Int:TopStart=140
Dim Top As Int:Top=1
Dim left As Int:left=1
Dim Count As Int:Count=0
Dim mp As Map:Dim lst As List
lst.initialize
strquery="SELECT MenuItemID from MenuItem order by MenuCode"
DBUtils.ExecuteList(Main.SQL1,strquery,Null,0,lst)
For i= 0 To lst.Size-1
strQuery1="Select MenuitemID, MenuItem.menuCode,MenuItem.menuitem, MenuGroup.GroupName, MenuGroup.GroupNumber from MenuGroup INNER JOIN MenuItem on MenuGroup.GroupID=Menuitem.GroupID where menuitemID=" &lst.Get(i)& " ORDER BY MenuCode"
mp.initialize
mp=DBUtils.ExecuteMap(Main.SQL1,strQuery1,Null)
'create 14 button per row
If Count=14 Then
Top=(((i)/14)*80)
left=1
Count=0
End If
btnMenu(i).Initialize(Null)
btnMenu(i).Tag=mp.Get("menucode")
btnMenu(i).TextSize=12
btnMenu(i).Text=mp.Get("groupname")&CRLF&mp.Get("menucode")&CRLF&mp.Get("menuitem")
btnMenu(i).WrapText=True
btnMenu(i).Id=(i)
frmOrderSelect.RootPane.AddNode(btnMenu(i),(left*Count)*100,Top+TopStart,100,80)
Count=Count+1
Next
End Sub