|
| Inicio → WINDEV 2024 → Generalise a function / Pass function by reference as parameter |
| Generalise a function / Pass function by reference as parameter |
| Iniciado por telenieko, 03,may. 2018 10:00 - No hay respuesta |
| |
| | | |
|
| |
Miembro registrado 2 mensajes |
|
| Publicado el 03,mayo 2018 - 10:00 |
Hi,
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').
So, I have a generic "UserLoginFromEnvironment" (take %username% do some stuff) and then a project-specific "HandleUserLoggedIn" (refresh tables, set some filters, ...)
The way to make this generic in Python would be to pass that function as an argument:
def handle_user_logged_in(user): print("project specific stuff")
def generic_user_login_from_environment(final_function): user = os.environ['USERNAME'] final_function(user)
# call the system: generic_user_login_from_environment(handle_user_logged_in)
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.
Any ideas?
Thanks in advance, marc |
| |
| |
| | | |
|
| | | | |
| | |
|