I am having another problem, though: when I compile on Windows, the text box and everything except the buttons and status text at the top (Music playing, music paused, etc) don't appear. When a button is clicked, most of the other buttons disappear as well. I can't figure out what X/Y coords to use to get them all to appear... some help?
Here's the full code:
'set appearance
Global Style:Int = WINDOW_TITLEBAR|WINDOW_MENU|WINDOW_STATUS|WINDOW_RESIZABLE
Global version:String = "0.9.1"
'music variables
Global music:TSound
Global channel:TChannel
Global paused:Int = 0
channel = AllocChannel()
'create window
Global mainWindow:TGadget=CreateWindow("Bookworm's OGG Player - Version "+version$,100,100,500,200,Null,Style)
'create music playing label
Global musicFile:TGadget=CreateLabel("No music playing...",10,10,900,100,mainWindow)
'create exit/reset
Global pExit:TGadget=CreateButton("Quit",430,5,50,20,mainWindow)
Global pReset:TGadget=CreateButton("Reset",350,5,50,20,mainWindow)
'create music file drop area
Global musicDrop:TGadget=CreateLabel("Enter music file here: ",10,50,20,20,mainWindow)
Global musicDropBox:TGadget=CreateTextField(100,20,200,20,mainWindow)
Global musicInfo:TGadget=CreateLabel("Current File: "+TextFieldText(musicDropBox), 10,80,200,200,mainWindow)
'create music options buttons
Global musicPlay:TGadget=CreateButton("Play!",350,35,50,20,mainWindow)
Global musicPause:TGadget=CreateButton("Pause",430,35,50,20,mainWindow)
Global musicStop:TGadget=CreateButton("Stop",350,65,50,20,mainWindow)
'main loop
Repeat
WaitEvent()
Select EventID()
'so you want to end it all?
Case EVENT_WINDOWCLOSE
End
Case EVENT_GADGETACTION
Select EventSource()
Case pExit
SetGadgetText musicFile,"Exiting..."
End
Case musicDropBox
SetGadgetText musicFile,"Attempting to load..."
SetGadgetText musicInfo,"Current File: "+TextFieldText(musicDropBox)
Case pReset
SetGadgetText musicFile,"No music playing..."
SetGadgetText musicDropBox,""
SetGadgetText musicInfo,"Current File: "
stopCurrent()
Case musicPlay
playCurrent()
Case musicPause
pauseCurrent()
Case musicStop
stopCurrent()
End Select
End Select
Forever
Function playCurrent()
music = LoadSound(TextFieldText(musicDropBox))
If music = Null
SetGadgetText musicFile,"Error: File Not Found!"
Else
PlaySound music,channel
SetGadgetText musicFile,"Music Playing!"
EndIf
End Function
Function stopCurrent()
StopChannel channel
SetGadgetText musicFile,"Music Stopped"
channel = AllocChannel()
If music = Null
SetGadgetText musicFile,"Error: File Not Found!"
EndIf
End Function
Function pauseCurrent()
If paused = 0
PauseChannel channel
SetGadgetText musicPause,"Resume"
SetGadgetText musicFile,"Music Paused"
If music = Null
SetGadgetText musicFile,"Error: File Not Found!"
EndIf
paused =1
Else If paused = 1
ResumeChannel channel
SetGadgetText musicPause,"Pause"
SetGadgetText musicFile,"Music Playing!"
If music = Null
SetGadgetText musicFile,"Error: File Not Found!"
EndIf
paused =0
EndIf
End Function
And a link to the file if you'd prefer: http://rybookrs.onlyplace4.com/forum/projects/bogg/bogg.bmx
|