<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><category>pcsoft.us.windev</category><copyright>Copyright 2026, PC SOFT</copyright><lastBuildDate>3 May 2018 10:00:09 Z</lastBuildDate><pubDate>3 May 2018 10:00:09 Z</pubDate><description>Hi,&#13;
&#13;
I have a set of functions I use for user management which are common to more than one project except for the very end of some processes which are project specific (aka: "HandleUserLoggedIn" 'event').&#13;
&#13;
So, I have a generic "UserLoginFromEnvironment" (take %username% do some stuff) and then a project-specific "HandleUserLoggedIn" (refresh tables, set some filters, ...)&#13;
&#13;
The way to make this generic in Python would be to pass that function as an argument:&#13;
&#13;
[code:python]&#13;
def handle_user_logged_in(user):&#13;
    print("project specific stuff")&#13;
&#13;
def generic_user_login_from_environment(final_function):&#13;
    user = os.environ['USERNAME']&#13;
    final_function(user)&#13;
&#13;
# call the system:&#13;
generic_user_login_from_environment(handle_user_logged_in)&#13;
[/code]&#13;
&#13;
NOW, What would be the right approach in WinDev? As far as I've seen, there is no way to pass functions by reference to another function, which prevents the "python way". I also though about events, but there does not seem to be a generic event bus/system available.&#13;
&#13;
Any ideas?&#13;
&#13;
Thanks in advance,&#13;
marc</description><ttl>30</ttl><generator>WEBDEV</generator><language>en_US</language><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/65352-generalise-function-pass-function-reference-parameter/read.awp</link><title>Generalise a function / Pass function by reference as parameter</title><managingEditor>moderateur@pcsoft.fr (El moderador)</managingEditor><webMaster>webmaster@pcsoft.fr (El webmaster)</webMaster></channel></rss>
