events callback chain WaitWindowEventsCallBack()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
idle
Always Here
Always Here
Posts: 5844
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

events callback chain WaitWindowEventsCallBack()

Post by idle »

It would be useful to have a cross platform events callback chain for the development of user controls
of for general use as an event driven UI model eg MyGadget_OnLeftClick()

Currently there is no cross platform native PB method to set a callback for a gadget or a custom gadget.
This usually results in the user of control having to place an update function to the control within their
events loop so it process internal events.

Proposed Functions

Code: Select all

SetEventCallBackGadget(Gadget,*Function.protoEventCallBackGadget,*UserData=0,EventType=-1) 
ChangeEventCallBackGadget(EventCallback,*Function.protoEventCallBackGadget,*UserData=0,EventType=-1) 
SetEventCallBackWindow(Window,*Function.protoEventCallBackWindow,*UserData=0,Event=-1) 
ChangeEventCallBackWindow(EventCallback,*Function.protoEventCallBackGadget,*UserData=0,Event=-1) 
WaitWindowEventCallBacks(timeout=0)
It could be implemented by either using a list or by directly setting a pointer in a gadgets or windows structure
similar to SetGadgetData()

Draft Implementation

http://www.purebasic.fr/english/viewtop ... 12&t=53772
Windows 11, Manjaro, Raspberry Pi OS
Image