Cancel
Showing results for 
Search instead for 
Did you mean: 

DropDown list problem

Creator
Creator

Im working in plant simulation 11 for students and i would like to ask for help.
I have a source for which I would like to set DeliveryTable (Table1 or Table2, depending on the analyzed problem). I do not want to do it manually so I came up with that I'll do it, using a dialog or DropDownList.
I would like it to work like: The dialog window is open and from list i can choose Table1 or Table2 and for example when i will press on Table2 then in options "source" DeliveryTable will change forTable2.
Same i would like to do with methods, For example have method 1 and method 2. When i choose from dialog windows method 1 then in store (tools->select observers) i would like to use choosen method automatically.

 

I knoow it may be problem with observer-method to set dynamically, so i tried to method obsever:

(attribute: string; oldValue: any)
is
do
if use_m1="yes" then
ref(M1).methcall(0);
elseif use_m1="no" then
ref(M2).methcall(0);
end;
end;

 

I used variable "Use_m1" and if variable= yes then  this method should be used as observer but it doeasnt work like .

 

 if you would give advice to send me the file, how it should be done, it would be a great help

Best regards,

4 REPLIES

Re: DropDown list problem

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi U_Jacob,

 

the easiest way is to use the clicked control of the DropDownList.

I've modified your model accordingly.

 

Regards,

Ralf

Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: DropDown list problem

Creator
Creator

Thanks, dropdown list working fine, but still i have problem cuz when I use method in store->tools->select observers (in fist windows "NumMu" and in second windows "method") then its not working.

 

Method is 

(attribute: string; oldValue: any)
is
do
if use_m1="yes" then
M1;
elseif use_m1="no" then
M2;
end;
end;

 

When variable use_m1 is for example "yes" simulation is stopping on store. Its like my M1 isnt working as observer

M1:

(attribute: string; oldValue: any)
is
do
if Store.numMU = 100 then
ref(MethodX).methCall(0);
Store.entranceLocked := true;
end;
if Store.numMU < some_variable then
Store.entranceLocked := false;
end;
end;

 

But still when i manually set M1 as observer it works fine.

Do u know what is wrong?

Re: DropDown list problem

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi U_Jacob,

 

for the observer problem you also can use the click control of the dropdownlist.

 

is
do
 if ?.item = "M1" then
  Store.removeObserver("NumMU", "M2");
  Store.addObserver("NumMU", "M1");
 else
  Store.removeObserver("NumMU", "M1");
  Store.addObserver("NumMU", "M2");
 end;
end;

 

M1 and M2 must be the observer methods.

 

Regards,

Karola

------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: DropDown list problem

Creator
Creator

It is working Smiley Very Happy Thanks!