Okay, this is my first program attempt in "Dark Basic Classic", so I appologize if this a completely lame question. Try as I might, I couldn't figure out what was wrong.
So, the problem is this: When I run the program, the "Main menu screen displays, but the text showing the cursor position and the variable value of "ButtonNumberMain", along with the entire bottom menu bar and the on/off buttons, are ALL blinking repeatedly in rapid succession. Yet, the weird thing is that when I put my cursor over one of the 'button defined areas', everything stops blinking. It's only when my cursor isn't over a button area that everything flashes. Why?????????
I've posted my entire program code from top to bottom. Sorry if you're annoyed by my organization methods. I like to have things clearly seperated -just makes it easier for me. I hope it isn't a problem.
Remstart
Charles Matthew Doan
September 26, 2005
Description:
This is a Graphical User Interface program containing a 'unit conversion calculator',
a 2D graphing program, and a compilation of notes for some of the most commonly used formulas
in the fields of Algebra, Geometry, and Trigonometry. I made this for two reasons.
The first and most important, was to familiarize myself with the syntax for a number of commands
in "Dark Basic", and the second was because it will probably be a useful tool for me
when I begin advanced geometry and physics during my next semester at school.
RemEnd
`INITIAL SETTINGS_______________________________________________________________________________________________
`_______________________________________________________________________________________________________________
Set Display Mode 1024, 768, 32
Ink rgb(0,0,0),rgb(255,255,255)
Sync On
Sync Rate 50
`000000000 LOAD MEDIA 0000000000000000000000000000
Load Bitmap "Main Menu.bmp": `Main Menu - Has Title and 5 Buttons, Each supposed to lead to a Different Section.
Get Image 1,0,0,1024,768,1
Load Bitmap "hand cursor.bmp": `Hand Cursor - This is a picture of a little hand pointer, intended to show when the mouse is over a button.
Get Image 2,0,0,19,29,1
Load Bitmap "option bar.bmp": `This is an image that contains 3 buttons, and will also hold the "Music On and Off" buttons. It is always present along the bottom of the screen.
Get Image 3,0,0,1024,80,1
Load Bitmap "Music On.bmp": `This is the "Music On" Button. Will show only when music is NOT playing
Get Image 4,0,0,206,66,1
Load Bitmap "Music Off.bmp": `This is the "Music Off" Button. Will show only when music IS playing
Get Image 5,0,0,206,66,1
Load Music "Wind.mp3",1: `Wind, by Akeboshi. If the user wants, they can let this song play while they browse the Math Notes.
`Note: Much more media to come eventually, but this is all that I have begun to implement so far.
`0000000000000000000000000000000000000000000000000
`***************** DECLARE VARIABLES ******************
MenuNumber = 1: `This shows which page the program is on. 1 = Main Menu, 2 = Algebra Notes Menu, 3 = Geometry Notes Menu, 4 = Trig Notes Menu, 5 = Conversion Calculator Menus, 6 = Graphing Program Menus.
ButtonNumberMain = 0: `This keeps track of which menu button the mouse is over on the 'Main Menu Page'.
LClickState = 0: `This will keep track of whether or not the left mouse button is clicked.
MusicState = 1: `This will keep track of whether or not music is playing.
`*******************************************************
`_______________________________________________________________________________________________________________
`_______________________________________________________________________________________________________________
` MAIN PROGRAM LOOP
`)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
do
cls: `Not sure if a "cls" is necessary here
`Actions For Main Menu Page
if MenuNumber = 1
paste image 1,0,0
MouseCheckMain()
ButtonNumberMain = MouseCheckMain()
endif
`End Actions for Main Menu Page
`To be Included Eventually + Bear in Mind, Each Note page and the two programs will have their own Button sets.
`Actions for Algebra Notes Page
`Actions for Geometry Notes Page
`Actions for Trigonometry Notes Page
`Actions for Conversion Calculators Page
`Actions for Graphing Program Page
`End 'To be Included'
`Menu Bar Actions - - - - - - - - - - - - - - - -
`These are the Actions to display and control the bottom menu bar, which will be present regardless of which page the GUI is currently viewing.
`The Menu Bar image has initially 3 buttons: 1 "Return to Main Menu", 2 "Back", and 3 "Forward". However, it also displays either a "Music On" or "Music Off" button, depending upon the variable "MusicState"
paste image 3,0,688: `Menu Bar Image
if MusicState = 1
paste image 5,806,695: `"Music Off" Button - To turn OFF Music
if music playing(1) = 0 then play music 1: `Only Plays if it is not already playing
else: `"If MusicState = 0"
paste image 4,806,695: `"Music On" Button - To turn ON Music
if music playing(1) = 1 then stop music 1: `Only tries to stop music if it is already playing
Endif
`End Menu Bar Actions - - - - - - - - - - - - - -
`(obviously incomplete, I need to include the ability to change "Music State" by clicking the On or Off Button. This will be a seperate function.)
`These two lines output the mouse position and the value of the variable "ButtonNumberMain". -Purely For Testing Purposes.
text 0,0,str$(mousex() ) + "," + str$(mousey() )
text 0,15,str$(ButtonNumberMain)
sync
loop
`)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
` End Main Loop
`__________________________________________User Defined FUNCTIONS___________________________________________________
`___________________________________________________________________________________________________________________
`FUNCTION - - - This checks to see if the mouse is over a button on the main menu page, it outputs the number of the button, or a 0 if the mouse is not over a button.
Function MouseCheckMain()
`Button 1 - Algebra Notes
if (mousex() > 19 and mousex() < 256 and mousey() > 183 and mousey() < 231)
hide mouse
paste image 2,(mousex() - 7),mousey(),1
exitfunction 1
Endif
`Button 2 - Geometry Notes
if (mousex() > 19 and mousex() < 289 and mousey() > 257 and mousey() < 304)
hide mouse
paste image 2,(mousex() - 7),mousey(),1
exitfunction 2
Endif
`Button 3 - Trigonometry Notes
if (mousex() > 19 and mousex() < 343 and mousey() > 336 and mousey() < 388)
hide mouse
paste image 2,(mousex() - 7),mousey(),1
exitfunction 3
Endif
`Button 4 - Conversion Calculator
if (mousex() > 19 and mousex() < 408 and mousey() > 419 and mousey() < 468)
hide mouse
paste image 2,(mousex() - 7),mousey(),1
exitfunction 4
Endif
`Button 5 - Graphing Program
if (mousex() > 19 and mousex() < 324 and mousey() > 501 and mousey() < 546)
hide mouse
paste image 2,(mousex() - 7),mousey(),1
exitfunction 5
Endif
show mouse
Endfunction 0
`END- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
`__________________________________________END User Defined FUNCTIONS_______________________________________________
`___________________________________________________________________________________________________________________
Lastly, if you see any parts of code that are blatently inefficient, or if you have any tips on a better way for me to do something, please state them. I'm a complete n00b when it comes to Dark Basic, and only a novice programmer at best.
-Thanks for any help.