Capturing GUI Events

BlitzMax Forums/BlitzMax GUI Programming/Capturing GUI Events

Hi guys,

Been trying to create my own front end for using gman's sid player modules and I'm doing well until I come to the part where I want to double click an entry in my loaded in playlist and I can't seem to get the right event information

Excuse if I'm posting this incorrectly but I'm trying to detect a double click from EventID() or even just a hit so I can do a manual count within the program to intercept it then I can play the double clicked track but I don't seem to be capturing events with this code. I'm trying to display them on the status bar so I know it's working but I must be doing something wrong.

Any help would be much appreciated - I won't have a problem finding out what item in the list has been double clicked, just knowing how to detect the mouse has been clicked in the first place would be a start.

' MARK: Main Loop
Repeat
	WaitEvent()
	Select EventID()
		Case EVENT_MOUSEDOWN
			Event = "Mouse Down"
			
		Case EVENT_MOUSEHIT
			Event = "Mouse Hit"
		
		Case EVENT_GADGETACTION
			DoGadgetAction()	

		Case Event_KEYDOWN
			Event = "Key Down"
			
	End Select
	SetStatusText Sidney , "Event: " + Event

Until EventID()=EVENT_WINDOWCLOSE Or UserHasQuit=True


What are you using to display the playlist? I'd assume you are using list boxes. List boxes should return EVENT_GADGETSELECT with single clicks and EVENT_GADGETACTION with double clicks and EVENT_GADGETMENU with right clicks.
This program shows this in action.
Strict
Global Window:TGadget = CreateWindow("Test",10,10,640,480)
Global List:TGadget = CreateListBox(20,20,400,300,Window)

AddGadgetItem(List,"First")
AddGadgetItem(List,"Second")
AddGadgetItem(List,"Third")

Repeat
	WaitEvent()
	Print CurrentEvent.ToString()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End
		Case EVENT_GADGETSELECT
			Print EventData()+" was single clicked"
		Case EVENT_GADGETACTION
			Print EventData()+" was double clicked"
		Case EVENT_GADGETMENU
			Print EventData()+" was right clicked"
	End Select
Forever

If that doesn't work for you, make sure your version of BlitzMAX is properly installed, upgraded and syncmodded.

Xerra, make sure to post your front end once it's done as the SIDplay for windows ui is horrible! :)

Wiebo: Be glad to post it up. I'm probably going to add a lot of features like custom playlists and stuff before I do.

TomToad: That's basically what I'm looking for. I presumed I'd have to use an event scan to capture the info I need but it looks like I missed the EVENT_GADGETACTION flag when I was re-reading the gui documentation. Thanks a lot for that, I'll give it a test run now.

As an update that example was all I needed to get it up and running. Fixed a few bugs and I've not got a working Sid tune player but the gui does need improving a bit now I've got it up and running.

As a matter of interest what kind of stuff does a Sid player need to do to improve on what the current favourite Sid player actually does?