cls set display mode 640,480,16 backdrop on: color backdrop rgb(0,0,0) sync on do Xmouse = mouseX() Ymouse = mouseY() ink rgb(200,200,200),0 Set cursor 0,440: print "Xmouse: ",Xmouse Set cursor 0,460: print "Ymouse: ",Ymouse Text 0,0, "Clique sobre o botão ´criar´para criar uma janela e sobre ´apagar´ para removê-la." Text 0,20, "by Aclive!" `Cria as janelas janela(100,100,rgb(111,111,111),rgb(39,92,182), "AClive", rgb(255,255,0)) janela(250,230,rgb(155,175,155),rgb(240,0,0), "Menu Inicial", rgb(0,255,0)) `botões botao(110,130,rgb(100,100,100), " Criar ",RGB(216,89,5) ) botao(110,160,rgb(100,50,70), "Apagar", rgb(200,0,20)) botao(110,190,rgb(70,50,200), " OK ", rgb(240,240, 20)) `Clicar sobre o primeiro botão ´Criar´ if Xmouse>110 and Xmouse<161 and Ymouse>130 and Ymouse<151 and mouseclick() = 1 push_botao(110,130, rgb(100,100,100)," Criar ", rgb(216,89,5)) nova_janela = 1 endif `Clicar sobre o segundo botão ´Apagar´ if Xmouse>110 and Xmouse<162 and Ymouse>160 and Ymouse<181 and mouseclick() = 1 push_botao(110,160, rgb(110,50,70), "Apagar", rgb(200,0,20)) nova_janela = 0 endif `Rotina que habilita / desabilita a janela if nova_janela = 1 then gosub acao_que_deseja_executada sync loop suspend for key end ` function que cria uma janela ............................................................................ function janela(x,y,cor,cor_tarja, texto$,cor_texto) `Efeito 3D ink cor + rgb(39,39,39),0 box x,y,x+201,Y+201 `Box principal da janela ink cor,0 box x,y,x+200,y+200 `Tarja da janela ink cor_tarja,0 box x+2,y+2,x+198,Y+15 `Texto na janela (título) ink cor_texto,0 Tx=(((x+198 - x+2)-(len(texto$)*8))/2)+x+2 Text Tx, y+2, texto$ endfunction `............................................................................................................ ` function que cria um botão ................................................................................ function botao(x,y,cor,textob$,cortb) `Efeito sombra ink rgb(10,10,10),0 box x+3,y+3,x+53,y+23 `Efeito 3D ink cor + rgb(30,30,30),0 box x,y,x+51,y+21 `principal ink cor,0 box x,y,x+50,y+20 `texto do botao ink cortb,0 Txb=(((x+54 - x+2)-(len(textob$)*8))/2)+x+2 Text Txb,y+2, textob$ endfunction `............................................................................................................. `function que cria o efeito do botão quando pressionado ...................................................... function push_botao(x,y,corpb, texto$, cort) `Cor de fundo da janela principal ink rgb(111,111,111),0 box x,y,x+53,y+23 `Efeito 3D ink corpb + rgb(30,30,30),0 box x+4,y+4,x+54,y+24 ` box x,y,x+53,y+53 ink corpb, 0 box x+3,y+3,x+53,y+23 ink cort,0 Txb=(((x+56 - x+4)-(len(texto$)*8))/2)+x+4 Text Txb,y+4, texto$ endfunction `............................................................................................................ acao_que_deseja_executada: janela(300,80,rgb(200,175,50),rgb(240,100,0), "Nova janela", rgb(250,255,50)) botao(315,110,rgb(70,50,200), " Novo ", rgb(240,240, 20)) return