Creating a Client Side Kind of Procedure

I want to create some kind of procedure like thing on the client side, which manipulates various variable values, and then I want to call it under certain conditions, such as when a button is clicked.

For those Bubblers amongst you, this would be the same as creating a Custom Event in Bubble.

How can I do that in Wappler?

Hi Antony,
If you provide some example of what are you trying to do, we will sure be able to answer your question :slight_smile:

Yes, @Teodor

Initially it is around window management… so will be lots of procedures that may look something like this in pseudo-code:

procedure close_message_windows()
begin
  show_message_editor = 0;
  show_message_viewer = 0;
  show_shortcode_viewer = 0;
  show_notifications = 0;
  show_left_menu = 1;
end;

Then I call that procedure when various different nav links are clicked.

Then just use the dynamic events for this.
You can set several actions to be run on specific dynamic event (depending on the element). They will all be run when this event is triggered.

Yes, but that is tied to the link, and I will have lots of link needing to do the same set of variable manipulation…

I am looking for a procedure type structure I can declare in one place and I can then bind to all the different links that then call it.

I don’t mind dropping into code to do it if required!

Not sure what you mean? The dynamic event could be anything - on show, or hide, on success, on error, on click etc... and all depends on the element.

However, i do understand your point, and it is a really nice idea - probably we can implement it in the future.

Thanks for your input, @Teodor.

Is there any way I can implement it using code right now?

Add the dynamic event with all the actions you need there, to your component/element then just copy it across your components where you need it :slight_smile:

Yes, but then when I need to change it, I have 10 different places to remember to go to to do that! :frowning:

Yes, indeed.

You could create a javascript function and call that. Search the forum for dmx.parse and dmx.app and you will probably find some examples of how to connect the two.

Thanks @mebeingken, you are a star! :slight_smile: