ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
#1
|
||||
|
||||
Updating Labels
Hello,
In a model when I am testing, the object labels are not updating when you press the Stop button until unless you click the mouse button in the view window. This happens if you write a code in Tools->Model Triggers->On Run Stop. Is there any way to update labels without clicking the mouse button. Thanks Naresh |
#2
|
||||
|
||||
Naresh,
In the code that fires when the model stops try inserting the following line of code: repaintall(): That command should repaint all of the windows and update the labels. Good Luck, Brandon
__________________
thats not normal. |
#3
|
||||
|
||||
Hello Brandon,
I have tried using repaintall(); but the labels of the object are not updating with the code written in "On Run Stop". Could you please look at it. Thanks Naresh |
#4
|
|||
|
|||
Hello Naresh,
maybe you can build up a small sample model, which show the problem and share it with the community. Then its easier for us to help you or to show you a solution for that. Regards Tobias |
#5
|
||||
|
||||
Hi Tobias,
Find the attached model. The label “status” is not updating when you press the “stop” button. But if you mouse click in any view windows then it’s changing. There is one line of code in : Tools->Model Triggers->On Run Stop Tools->Model Triggers->On Run Start Regards Naresh |
#6
|
|||
|
|||
Hi naresh,
I tested your model and also have the same problem as you. status is not updated in the tree. The label is updated but you can not see it until click in the view, so it looks like it a bug in the updating of the tree. If you want to be sure that the label is updated, add this line after your setlabelnum in OnRunStop: pt("status=");pf(getlabelnum(current,"status")); pr(); Open the console window and run the model, you will see that status has value 0 in the console but not in the tree. Lars-olof |
#7
|
||||
|
||||
Naresh,
The fact that the window isn't being repainted when you hit the stop button is why the label appears to not be updating. The node is updating, but the window isn't repainting to show the change as you can see by following Lars-olof's instructions. When you click in a window, it receives a paint message so it redraws itself with the updated data. I'm not sure why repaintall() isn't working to fix the problem, but if you really need this functionality, the following lines of code do work here: forobjecttreeunder(node("VIEW:/1")) { repaintview(a); } This essentially does the same thing as repaintall(), except it sends a repaint message to every control widget instead of just each window. (Thus sending a repaint message to the tree control widget itself instead of just the window that has a tree control widget in it.) |
The Following 3 Users Say Thank You to Phil BoBo For This Useful Post: | ||
Tom David (03-29-2008) |
Thread | Thread Starter | Forum | Replies | Last Post |
can I use an edit box entry to update multiple labels? | KelvinHo | Q&A | 10 | 03-28-2008 07:17 AM |
Display Labels with the Recorder | tsconcept | Q&A | 9 | 09-26-2007 08:16 AM |