[WM18 android] procedure Parameter

Startbeitrag von ccc2 am 03.02.2014 10:32

Hi,

is it normal for 2 windows , I declare a parameter with same name and get error of duplicate name when compile?

i know will get error if parameter on windows procedure level same as local procedure . but i don't think 2 windows with same name for parameter declaration will get error .

is this normal ? or bugs in WM18 ?

Antworten:

Hi CCC

I'm not sure I understand your problem.
Are you making 2 windows and then declaring a local procedure for each window but with the same name ?
Please make sure you are not declaring one of the procedures as glabal.

Best regards
Viggo Poulsen

von Viggo Poulsen - am 03.02.2014 11:23
Hi Viggo

I'm not declaring local procedure . I want to pass parameter to the windows .

openchild(my_win1, param_1, param_2)
openchild(my_win2, param_1, param_2)


on the global declaration of my_win1
procedure m_win1 (param_1 is int , param_2 is int, param_3 is currency)


on the global declaration of my_win2
procedure m_win2 (param_1 is int , param_2 is int, param_3 is currency)

as i press enter I get error :
"ambiguities may occur with global variable my_win1.param_3"

problem solve if i rename param_3 in my_win2 to another name.

von ccc2 - am 05.02.2014 11:24
I would also pass them "by value" and not "by reference" to avoid that chaincing the value of param3 in one window is reflected in the other when they are both open. I'm not sure how WM or Android handles this.
procedure m_win1 (LOCAL param_1 is int , LOCAL param_2 is int, LOCAL param_3 is currency)

von Arie - am 05.02.2014 11:30
Hi ccc2

Your openchild of mywin1 and mywin2 do not mention param_3 so that may be the problem. Normally you have to declare it as 'optional parameter' like this:

procedure m_win1 (param_1 is int , param_2 is int, param_3 is currency = 0)
procedure m_win2 (param_1 is int , param_2 is int, param_3 is currency = 0)

Could you try this ?

Best regards
Viggo Poulsen

von Viggo Poulsen - am 05.02.2014 13:05
Quote
Arie Mars
I would also pass them "by value" and not "by reference" to avoid that chaincing the value of param3 in one window is reflected in the other when they are both open. I'm not sure how WM or Android handles this.
procedure m_win1 (LOCAL param_1 is int , LOCAL param_2 is int, LOCAL param_3 is currency)


Arie , I tried that before . still get same error


Quote
Viggo Poulsen
Hi ccc2

Your openchild of mywin1 and mywin2 do not mention param_3 so that may be the problem. Normally you have to declare it as 'optional parameter' like this:

procedure m_win1 (param_1 is int , param_2 is int, param_3 is currency = 0)
procedure m_win2 (param_1 is int , param_2 is int, param_3 is currency = 0)

Could you try this ?

Best regards
Viggo Poulsen


thanks Viggo , it work

von ccc2 - am 06.02.2014 11:58
I also encounter the similar error on declaring variable

let me explain
on project code, I declare 2 structure

RetVal_1 is Structure
Exit_val is boolean
item_code is string
item_ref is string
END

RetVal_2 is Structure
Exit_val is boolean
Amount_paid is currency
END

I have 2 windows . win_A and win_B . inside win_A i call win_B by
openChild(win_B)

on Global Declarations of win_A
l_retVal is RetVal_1

on Global Declarations of win_B
l_retVal is RetVal_2


i get error on win_A
"Declaration of global variable 'l_retVal' hide global variables 'l_retVal' of win_B windows"

i think something very wrong with the WM18 compiler for android , seem like all scopes are mess up . for now , I change the name of the variable . I hope the problem not persist in WM19.

von ccc2 - am 06.02.2014 12:11
on win_A , I rename the l_retVal to l_retVal_A .

this cause the following code generate error in win_A

l_retVal.item_code = "aaa"
l_retVal.item_ref = "123"

but this code does not generate error in win_A
l_retVal.Exit_val = true



on win_B , I rename l_retVal to l_retVal_B .

this cause the following code generate error in win_B
l_retVal.Exit_val = true
l_retVal.Amount_paid = 1

not only that all code "l_retVal.Exit_val=" in win_A generate error.

what going on ? i'm now starting to worry whether the value in a variable is correct .

von ccc2 - am 06.02.2014 12:27
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.