PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → How to pass parameters to an Internal Windows (WD)?
How to pass parameters to an Internal Windows (WD)?
Débuté par Steven Sitas, 25 juil. 2014 17:42 - 6 réponses
Posté le 25 juillet 2014 - 17:42
Hi,
I have a "host Window" that contains one (or more) internal windoww.
I need to pass some parameters/info to the internal window, when I open/call the host window.

Any Ideas?

Steven Sitas
Posté le 25 juillet 2014 - 18:01
Hi Steven,

Explained here, section "Passing parameters to an internal window": <a class="ExternalLink" rel="nofollow" target="_blank" href="http://doc.windev.com/en-US/?1013259">http://doc.windev.com/en-US/&hellip;</a>

Best regards,
Alexandre Leclerc
Posté le 25 juillet 2014 - 18:15
Hi Alexandre,
the problem with the technique described in the above section, is the following:

1) I have code in the host window - say in the initialization section - where I call IW_MyInternalWin.Init(Param1, Param2)

2) I have ALSO code in the INITIALIZATION of the Internal Window.

The code in the initialization of the Internal Window (No 2) fires up BEFORE I call IW_MyInternalWin.Init(Param1, Param2) - in the host !!!!

Is there a way to run code (1) before code (2) ?

I have been using Global Variables to pass the parameters to the IW, but since I had some free time I am trying to see what other options I have ...

Steven Sitas
Posté le 25 juillet 2014 - 18:34
Hi Steven,

In my internal windows I just declare global variables in the Global Declarations section of the window and then update them from the main window by a direct reference any time I need them updated.

IW_WindowName.nVariableName = X

Then if I need to refresh the the internal window I use a local procedure in the internal window and call that from my main window

IW_WindowName.LP_LocalProcedureName

This allows me to have the internal windows be responsive to data entered in the main windows.
I use this method in a quite a few areas and it works well.
Hope this helps.

Steve
Posté le 25 juillet 2014 - 19:00
Thanks Steve, I will give it a try

Steven Sitas
Posté le 25 juillet 2014 - 19:14
Hi Steven,

If you use ChangeSourceWindow() you can pass parameters at the same time. (I avoid this path because it only works when using that command.)

I personally do as Steve suggested. In every internal Window I have an Initialize/Refresh command and globals. For simplicity I usually avoid the globals because you always miss something. The Initialize/Refresh command usually receives the arguments that need to be refreshed. (Something like that: Refresh(p is string = gsP, b is bool = gsB), so if you do not specify the params, it uses the globals.)

Best regards,
Alexandre Leclerc
Posté le 25 juillet 2014 - 19:40
Thanks Alexandre
I just tested what you and Steve suggested and it works fine

Steven Sitas