[Done] BindVariableEvent()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
falsam
Enthusiast
Enthusiast
Posts: 630
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

[Done] BindVariableEvent()

Post by falsam »

I wonder if that request wouldn't be stupid!!

BindVariableEvent() to redirect any variable change (Integer, String, Array, Structure, List, Map ...) to a procedure.

Code: Select all

Define a

BindVariableEvent(a, @onChange())

Procedure onChange()
  Debug a
EndProcedure
:wink:
Last edited by falsam on Wed Jul 04, 2018 5:15 pm, edited 1 time in total.

➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect.
User avatar
NicTheQuick
Addict
Addict
Posts: 1226
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: BindVariableEvent()

Post by NicTheQuick »

That is not possible at runtime because there are no interrupts you can attach to a single memory location. And if there would be an extra thread which is continuously watching that specific memory location you would have high CPU usage and you could also miss some events, e.g. the variable is toggling very fast between 0 and 1.
However I think it could be possible with "Runtime" variables but maybe this is not what you want. It would make anything slower because every write access to the variable would need more instructions than usual.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
User avatar
falsam
Enthusiast
Enthusiast
Posts: 630
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: BindVariableEvent()

Post by falsam »

Thank you for the precision of this answer. My request was stupid. I did a comparison with the gadget IDs.

➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect.
Post Reply