First of all, I strongly advise you remove sync rate as his will effectively cause the buttons ect to flash on the screen after every sync.
the b1 = X is not even a command. You have a return value and list of parameters but no function there!! Heres how your snippet of code should really look like;
GLOBAL dbpro_w
dbpro_w=get dbpro window() : set main window dbpro_w
w1 = make window(640,480,"Window",dbpro_w)
b1 = make button(20,20,100,20,"Button!",w1)
Heres one of my pieces of code which involves a window and a button. It has a couple of other things, but just ignore what you dont want, perhaps it will help you with what your wanting to achieve what ever that may be.
np = make window((desktop width() - 400)/2,(desktop height() - 200)/2,400,200,"New Project Window",dbpro_w,WS_EX_STATICEDGE||WS_OVERLAPPED)
tv=make treeview(1,1,200,170,np)
tv_root=treeview insert item(tv,"Projects", -1, -1)
set dir masterdir$
DIM folderpath$(1000) AS STRING
DIM tv_folder(1000) AS INTEGER
X = 0
foldermax = 0
perform checklist for files
repeat
inc X, 1
folder = 0
a$ = checklist string$(X)
for t=1 to len(a$)
if mid$(a$,t) = "." then inc folder, 1
next t
if folder = 0
folderpath$(foldermax+1) = a$
tv_folder(foldermax+1) = treeview insert item(tv, folderpath$(foldermax+1), -1, -1, tv_root)
inc foldermax, 1
endif
until X = checklist quantity()
l = make label(205,5,200,20,"Project Name:",np)
npe1 = make editbox(215,25,170,20,ES_LEFT,np)
l = make label(205,55,200,20,"Include Folders:",np)
npsl1 = make checkbox(215,75,80,20,"Bin",np)
npsl2 = make checkbox(215,95,80,20,"Images",np)
npsl3 = make checkbox(215,115,80,20,"Updates",np)
npsl4 = make checkbox(295,75,80,20,"Data",np)
npsl5 = make checkbox(295,95,80,20,"Sounds",np)
npsl6 = make checkbox(295,115,80,20,"Export",np)
npbt1 = make button(225,145,80,20,"Make",np)
npbt2 = make button(310,145,80,20,"Cancel",np)
do
clear = 0
if button clicked(npbt1)
projectname$ = window get text(npe1)
if projectname$ <> "" then clear = 1
if clear = 1
make directory masterdir$ + "\Projects\" + projectname$
if checkbox get state(npsl1) then make directory masterdir$ + "\Projects\" + projectname$ + "\Bin"
if checkbox get state(npsl2) then make directory masterdir$ + "\Projects\" + projectname$ + "\Images"
if checkbox get state(npsl3) then make directory masterdir$ + "\Projects\" + projectname$ + "\Updates"
if checkbox get state(npsl4) then make directory masterdir$ + "\Projects\" + projectname$ + "\Data"
if checkbox get state(npsl5) then make directory masterdir$ + "\Projects\" + projectname$ + "\Sounds"
if checkbox get state(npsl6) then make directory masterdir$ + "\Projects\" + projectname$ + "\Export"
if file open(1) then close file 1
projectcorevariablefile$ = masterdir$ + "\Projects\" + projectname$ + "\" + projectname$ + ".cvf"
projectpascalfile$ = masterdir$ + "\Projects\" + projectname$ + "\" + projectname$ + ".pas"
projectdate$ = get date$()
template1$ = "REM Project: " + projectname$ + split() + "REM Created: " + projectdate$ + split() + "REM" + split() + "REM ***** Main Source File *****" + split() + "REM" + split() + split()
open to write 1, projectcorevariablefile$ : close file 1
open to write 1, projectpascalfile$ : write string 1, template1$ : write string 1, "{-stop loading file-}" : close file 1
window set text e1, template1$
window set text e3, linenumbers()
window set text e2, window_2_text()
delete window np
exitfunction
endif
endif
if button clicked(npbt2)
delete window np
exitfunction
endif
loop
