question

Devdatta D avatar image
0 Likes"
Devdatta D asked Andrew O commented

Change conveyor length using GUI

I am trying to edit the length of conveyor using gui. When I add coldlink to length variable I can see the current length but when i change it it doesn't change the conveyor length visually.

FlexSim 22.2.4
conveyorguiconveyor length
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Andrew O avatar image Andrew O commented ·

Hi @Devdatta D, was Matthew Gillespie's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered Devdatta D commented

You should use a coldlinkx node and get/set the HorizontalLength property of the conveyor.

Object conveyor = Model.find("StraightConveyor1");
string property = "HorizontalLength";

if (eventdata) {
    conveyor.setProperty(property, getviewtext(c).toNum());
    repaintall();
} else
    setviewtext(c, conveyor.getProperty(property));

Here's an example model, ConveyorLengthGUI.fsm


· 12
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Devdatta D avatar image Devdatta D commented ·
Thanks. I had a question on the code. Why did you use eventfunctions in the tree? What does on kill focus do?
1 Like 1 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Devdatta D commented ·
The code in OnKillFocus is fired when the field loses keyboard focus (after you type something in and then click off). The eventfunctions node is just a node to contain all the code function nodes that the field uses. You don't need it in this case, but there are some cases where the function node has to be under an eventfunctions node to be called.
1 Like 1 ·
Devdatta D avatar image Devdatta D Matthew Gillespie ♦♦ commented ·
I can write regular flexscript in the gui builder?
0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.