hi can someone help plz
I`ve created a window with options for my tools in mi pain prog
but when i try to swap between the functions it only works when the mouseclick is held down as soon as its released it goes back to the first function.
i probably havent explained it too well here is my source
REM Project: kidpaint 1
REM Created: 04/01/2007 18:08:32
REM
REM ***** Main Source File *****
REM
startBlue "",""
sync on: sync rate 0
rem memory program
colour as dword
#include "gui.dba"
set window on
set window position 140,0
SET WINDOW LAYOUT 4,1,0
cls rgb(255,255,255)
ink rgb(0,0,0),rgb(0,0,0)
rad=10
gosub gui
do
getevent
if eventtype()=MOUSE_CLICK and eventsource()=palettebutt
colour=colorDialog()
red = rgbr(colour)
green = rgbg(colour)
blue = rgbb(colour)
ink rgb(red,green,blue),rgb(0,0,0)
endif
if eventtype()=MOUSE_CLICK and eventsource()=pensize1
rad=10
endif
if eventtype()=MOUSE_CLICK and eventsource()=pensize2
rad=20
endif
if eventtype()=MOUSE_CLICK and eventsource()=pensize3
rad=30
endif
if eventtype()=MOUSE_CLICK and eventsource()=pensize4
rad=40
endif
if eventType()=MENU_CLICK
select eventData()
case 1
save$=savedialog("save File","bmp (*.bmp)|*.bmp")
get image 1,0,0,640,480,1
save image save$,1
endcase
case 2
exit
endcase
case 3
message "kid paint 1.0 by chunks 2007"
endcase
case 4
cls rgb(255,255,255)
endcase
case 5
screensize=createwindow(350,250,130,90,"change screensize",WINDOW_FIXED,WINDOW_TOOLWINDOW ,0,0)
scxlabel=createLabel(10,10,10,20,"x",screensize)
scsizex=createEdit(25,10,40,20,0,screensize)
scylabel=createLabel(10,35,10,20,"y",screensize)
scsizey=createEdit(25,35,40,20,0,screensize)
scokbutt=createbutton(70,10,40,20,"ok",0,screensize)
scexitbutt=createbutton(70,35,40,20,"exit",0,screensize)
setGadgetVisible screensize,1
endcase
case 6
colour=colorDialog()
red = rgbr(colour)
green = rgbg(colour)
blue = rgbb(colour)
ink rgb(red,green,blue),rgb(0,0,0)
endcase
endselect
endif
if eventtype()=MOUSE_CLICK and eventsource()=scexitbutt
setGadgetVisible screensize,0
endif
pen(rad)
sync
loop
gui:
penwin=createwindow(10,300,70,88,"pensize",WINDOW_FIXED,WINDOW_TOOLWINDOW ,0,0)
pensize1=createbutton(0,0,32,32,"1",0,penwin)
pensize2=createbutton(32,0,32,32,"2",0,penwin)
pensize3=createbutton(0,32,32,32,"3",0,penwin)
pensize4=createbutton(32,32,32,32,"4",0,penwin)
palette=createwindow(10,200,70,88,"pallete",WINDOW_FIXED,WINDOW_TOOLWINDOW ,0,0)
palettebutt=createbutton(0,0,69,87,"clickme",0,palette)
toolwindow=createwindow(10,100,70,88,"tools",WINDOW_FIXED,WINDOW_TOOLWINDOW ,0,0)
pentool=createbutton(0,0,32,32,"1",0,toolwindow)
spraytool=createbutton(32,0,32,32,"2",0,toolwindow)
linetool=createbutton(0,32,32,32,"3",0,toolwindow)
filltool=createbutton(32,32,32,32,"4",0,toolwindow)
mainMenu=createMenu(0)
addMenuItem mainMenu,"File",1
addMenuItem mainMenu,"tools",3
addMenuItem mainMenu,"help",2
fileMenu=createSubMenu(mainMenu,1)
aboutMenu=createSubMenu(mainMenu,2)
toolsMenu=createSubMenu(mainMenu,3)
addMenuItem fileMenu,"save",1
addmenuitem filemenu,"clearscreen",4
addMenuItem filemenu,"exit",2
addMenuItem aboutmenu,"about",3
addMenuItem toolsmenu,"screensize",5
addMenuItem toolsmenu,"palette",6
return
function pen(rad)
if mouseclick()=1
x=mousex()
y=mousey()
for count=1 to rad
BOX x-count,y-sqrt((rad^2)-(count^2)),x+count,y+sqrt((rad^2)-(count^2))
next count
endif
endfunction
function neverCalled()
delete memblock 0
endfunction
function spray(rad)
if Mouseclick() = 1
start:
x = rnd(rad) - rad
y = rnd(r) - rad
If sqrt((x# * x#) + (y# * y#)) > rad then goto start
circle mousex() + x,mousey() + y,1
Endif
endfunction
function lines()
repeat
if mouseclick()=1 and hold=0
ax=mousex()
ay=mousey()
hold=1
endif
if mouseclick()=1 and hold=1
copy bitmap 1,0,0,w,h,0,0,0,w,h
bx=mousex()
by=mousey()
line ax,ay,bx,by
line ax+1,ay+1,bx+1,by+1
line ax+2,ay+2,bx+2,by+2
line ax+3,ay+3,bx+3,by+3
line ax+4,ay+4,bx+4,by+4
line ax+5,ay+5,bx+5,by+5
line ax+6,ay+6,bx+6,by+6
endif
if mouseclick()=0 and hold=1 then hold=0 : copy bitmap 0,1
until hold=0
endfunction
function special(rad)
fcolor= rgb(rnd(255), rnd(255), rnd(255))
ink fcolor, rgb(255,255,255)
if mouseclick()=1
circle mousex(),mousey(),rad
endif
endfunction