Buttons

BlitzPlus Forums/BlitzPlus Beginners Area/Buttons

SkidMarcUK(Posted 2012) [#1]
I need 3 buttons down the bottom of this to change date month and a "GO" button. Can you use createbutton command or do you need to create these with boxes and stuff.


[bbcode]
;go into graphics mode
Graphics 640,520,16,2

; Create array
Dim nums1(64)
Dim nums2(64)

; Fill each element with a random number
For i = 0 To 63
nums1(i) = Rand(70,100)
Next
; Fill each element with a random number
For j = 0 To 63
nums2(i) = Rand(70,100)
Next
p=0


;fonts
fntArial1=LoadFont("Arial",75,True)
fntArial2=LoadFont("Arial",120,True)
fntArial3=LoadFont("Arial",50,True)
fntArial4=LoadFont("Arial",15,True)



;stars
Starfield1=CreateImage(640,480)
Cls
Color 75,75,75
For dot=1 To 200
Oval Rnd (1,640),Rnd (1,480), 3,3,1
Next
GrabImage Starfield1,0,0

Starfield2=CreateImage(640,480)
Cls
Color 125,125,125
For dot2=1 To 150
Oval Rnd (1,640),Rnd (1,480), 4,4,1
Next
GrabImage Starfield2,0,0

Starfield3=CreateImage(640,480)
Cls
Color 200,200,200
For dot3=1 To 100
Oval Rnd (1,640),Rnd (1,480), 5,5,1
Next
GrabImage Starfield3,0,0

Cls

;initialize scroll variable to 0

scroll_x=0

;loop until ESC hit
While Not KeyDown(1)
Cls
Delay 20


; Fill each element with a random number

p=p+1
If p=5 Then
For i = 0 To 63
nums1(i) = Rand(70,100)
Next
; Fill each element with a random number
For j = 0 To 63
nums2(i) = Rand(70,100)
Next
p=0
EndIf

For l=0 To 63 Step 1
Color nums1(l),0,nums1(l)
Rect l*10,0,10,640,1
Next


Color 255,255,255
Rect 55,95,530,310
Viewport 60,100,520,300
;draw the backdrop
TileBlock Starfield1,scroll_x,0

;draw it again, but across a bit and moving 'faster'
TileImage Starfield2,scroll_x*2,9

;and again!
TileImage Starfield3,scroll_x*3,23

;scroll the backdrop
scroll_x=scroll_x+1
If scroll_x=ImageWidth(Starfield3) Then scroll_x=0


;title
Viewport 0,0,800,600
SetFont fntArial1

Color 0,0,0
Text 330+Cos(zz)*50,20,"HOROSCOPE",True
Color 0,0,255
Text 320+Cos(zz)*50,5,"HOROSCOPE",True
zz=zz+5
If zz=360 Then zz=0

;flip the front and back buffers

Flip

Wend

[/bbcode]


Andy_A(Posted 2012) [#2]
Look at CreateWindow, CreateCanvas and, CreateButton.

Otherwise your going to have to make your own buttons and track mouse clicks.

If you take the time to learn how to use the Windows gadgets you'll find that some projects can be very easy to make.


Andy_A(Posted 2012) [#3]
(double post)

Last edited 2012