[Gambas-user] sdl2 application

T Lee Davidson t.lee.davidson at gmail.com
Wed May 4 15:03:37 CEST 2022


On 5/4/22 00:50, Charles Bukowski wrote:
> Yes :
> Public Sub TestAudioPlay_Open()
> audio = New Channel As "audio"
> End
> 
> Debug output :
> TestAudioPlay.PlayAudio.21: sample is null: False
> TestAudioPlay.PlayAudio.22: audio is null: True

In the TestAudioPlay.class file, that should be:

Public Sub Form_Open()  ' Not TestAudioPlay_Open()
   audio = New Channel As "audio"
End

The TestAudioPlay form does not know its own name. It just knows it is a Form. A form's name is for the benefit of classes and 
modules external to that form. It allows us to call Public methods, and access Public properties, of distinct classes/modules. 
This is how we can call FMain.Close from TestAudioPlay.

When designing/editing a form in the GUI editor, you can right-click on an object and then bring the mouse cursor over "Event" 
in the pop-up context-sensitive menu. That will show a list of the events that particular object raises. When you select a 
certain event, you will get an empty event handler subroutine in the form's class file/tab.


-- 
Lee


More information about the User mailing list