[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Object.Attach silently does nothing for a plain observer class


Le 09/09/2026 à 11:00, Alarch a écrit :
Dear Benoît, dear all,

A separate report from my other message about GB_BASE (keeping one topic
per mail) - another gotcha from the same small llhttp-based HTTP server
proof-of-concept, this time on the Gambas language side rather than the
native-component side.

I wanted a small custom class (one instance per accepted connection) to
receive both a Socket's "Read" event and my own component's custom event,
so I used:

     Object.Attach(Me, hSocket, "Socket")
     Object.Attach(Me, hParser, "Parser")

expecting Socket_Read and Parser_MessageComplete to fire on Me.

This is the other way around:

Object.Attach(Object, ObserverObject, EventName)

The first argument is the object that sends the event. The second argument is the object that receives the event.

--
Benoît Minisini.