Funciones con parámetros - Forum

Forum Navigation
You need to log in to create posts and topics.

Funciones con parámetros

Hola,

Es posible definir parámetro en las subrutinas o funciones como en otros lenguajes.  He visto que cuando creas una subrutina, en la parte inferior de la ventana sale una pestaña con el nombre de parámetros, pero no sé si se refiere a los parámetros de una función.

Roger Rey

@rrey

Si ... :-))

In VisualNEOWeb (unlike VisualNEOWin), subroutines can accept parameters ... subroutines can be scripted in VisualNEOWeb commands or Javascript.

Also, in VisualNEOWeb, you can create plugins (external modules that can be deployed in multiple projects ; somewhat like Call'ed Functions in VisualNEOWin) ... and plugin commands also accept parameters.

 

 

S

@gaev Y cómo se ponen los parámetros.  No he visto información de ayuda.

@rrey

And how the parameters are set. I have not seen help information.

1) File >>> neoResizableTutorial.neoApp (in the Tutorials folder)

2) Project >>> Subroutines

The popup window has 3 parts ...

- left column has names of subroutines
- right side has...
- top section for code
- bottom section of parameters

Bottom section has two Tabs (Parameters and Hint).

The Hint you specify will appear on the popup window when ever you define (at design stage) this subroutine from within your project.

Within the Parameters Tab, you manage (add, edit delete) parameter definitions using the buttons on the right side ...

- Alias is the variable name you use inside the subroutine script for the Nth (1st, 2nd, 3rd etc.) parameter passed from the invoking command
- Type must match the variable type that is passed from the invoking command
- Description appears (underneath the TextEntry Box) in the popup window when ever you define (at design stage) this subroutine from within your project.

In this Tutorial App, you will find ...

- on page labelled Limited Resize
- a button labelled LimitedResizeOn

... in the code section, you will see ...

neoResizableOn "LimitedResizeContainer" "ResizeHandle" "" "[thisMaxWidth]" "" "[thisMaxHeight]" "LimitedResizeEnded"

... the last parameter is a subroutine to be invoked whenever the user ends resizing the object.

In the subroutines section, you will find a subroutine named LimitedResizeEnded ... it contains just one command i.e. a call to another subroutine ...

ShowContainerDimensions "[ResizedObject]"

... the value of this parameter ([ResizedObject]) will be passed to subroutine ShowContainerDimensions ... this subroutine can access this passed value using the variable [ContainerName] ... because this variable was defined as the first parameter for this subroutine in the bottom right section.

Vadim has reacted to this post.
Vadim

Muchas gracias. Funciona.