Yet Another Problem - X/Y Coordinates in Windows

BlitzMax Forums/BlitzMax Beginners Area/Yet Another Problem - X/Y Coordinates in Windows

bookworm99(Posted 2008) [#1]
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


Jesse(Posted 2008) [#2]
here is your error:
Global musicFile:TGadget=CreateLabel("No music playing...",10,10,900,100,mainWindow)
does this really need to be 900 width?


bookworm99(Posted 2008) [#3]
I spose not. Could that be causing it..? I originally set that back when there was nothing else on the screen, so it's a possibility x.x


Jesse(Posted 2008) [#4]
definitely. you are covering all of the buttons with the label when updating it.


bookworm99(Posted 2008) [#5]
Sounds like something I oughta fix XD. I'll set it to like 200 or so. What about the text box for entering files and the output of the current filename?


Jesse(Posted 2008) [#6]
same think you are covering it with the label. you are going to have to find a different way to display the label use an alternative such as "notify".


bookworm99(Posted 2008) [#7]
Well, I changed the label's width to 200, and the buttons all display correctly now. The textbox, however, does not, and nither does the current filename thing. Maybe the label is too wide?

Edit: I've fixed the textbox, the only problem now is the current file output.


Jesse(Posted 2008) [#8]
have you gone through the tutorials by assari. They are very helpfull and will help you understand alot of the stuff you are having problems with:
http://www.blitzmax.com/Community/posts.php?topic=54579


bookworm99(Posted 2008) [#9]
I have done some of them, yes, actually. Right now, I just need to get the length/width/position figured out for that one label.

Edit: I've fixed the label; the width for the label for the textbox was set too high. Thanks for all your help.