An additional parameter in the Bind... Event () commands would be very useful, e. g. for a this-pointer. Ok, I can store this as Data in the Window/Gadget, but that's not very elegant.
In the forum I found several posts about this, but obviously nobody thought about posting this also in the Wishlists.
Bind...Event() with additional paramter
Bind...Event() with additional paramter
sorry for my bad english
Re: Bind...Event() with additional paramter
Is EventData() an option ?
Re: Bind...Event() with additional paramter
+1 It is a very common practice for a callback to supply a value that gets passed to the callback.
Eventdata is just for customs events no? And may be in use for other things.
I have been missing this since events were introduced but i did not bother to ask because i have very few hopes it gets included.
Eventdata is just for customs events no? And may be in use for other things.
I have been missing this since events were introduced but i did not bother to ask because i have very few hopes it gets included.
Re: Bind...Event() with additional paramter
Do you have example code that demonstrates the way the proposed change would be used?
Re: Bind...Event() with additional paramter
It would be very helpful for custom/complex GUIs or games.Demivec wrote:Do you have example code that demonstrates the way the proposed change would be used?
Im not sure why anyone would prefer this or EventData() over a additional parameter.
Code: Select all
*Chess.CHESS_STRUCT = GetGadgetData(EventGadget())
Re: Bind...Event() with additional paramter
I think is a god idea
This work
Link: http://www.purebasic.fr/english/viewtop ... 12&t=69352
This work
Code: Select all
;-TOP
; Comment : Module MyBindEvent with EventData
; Author : mk-soft
; Version : v1.0x
; Created : 07.10.2017
; Updated :
; Callback syntax : BindGadgetCB(EventData)
DeclareModule MyBindEvent
Declare MyBindGadgetEvent(Gadget, *Callback, EventType = #PB_All, EventData = 0)
Declare MyUnbindGadgetEvent(Gadget, *Callback, EventType = #PB_All)
EndDeclareModule
...
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: Bind...Event() with additional paramter
...now imagine we would not need to do workaroundsmk-soft wrote:I think is a god idea
This work
...