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
|
||||
|
||||
Double click to execute the onpress function
Hi, all
I wrote several functions within a GUI, the onpress() function worked fairly well with first button, but as for the second button, it works only if I click it twice. I encountered this problem once with a very simple model and a GUI, the solution I chose then is to open a new model and created the same GUI for a next time. However, perhaps there is something easier to do with this problem. Regards~ |
#2
|
|||
|
|||
I share your confusion. This shouldn't happen. Try putting pt("onpress called");pr(); at the beginning of your onpress code and checking the output console. Maybe the code is being called, but the nature of your code switches something each time.
|
#3
|
||||
|
||||
the onpress function works, with several seconds' delay
Thanks, Alex!
Clearly and instantly I find a "onpress called" at the ouput console, however, the result of my onpress fuction appears several seconds later. Perhaps it is because those for loop codings within the onpress function, which controls output of two globaltable. In addition, my ortho window turns out totally black before compiling the model, is that normal or because of some codings I added? Eager to know the answer~~ Sophia |
#4
|
|||
|
|||
I'm not sure about the compiling, but I think I can help with the tables. Your code probably looks something like this:
Code:
for(int row=1;row<=gettablerows("mytablename");row++){ for(int col=1;col<=gettablecols("mytablename");col++){ //you probably don't do something this simple, //but it's just an example that doubles each value double value=gettablenum("mytablename",row,col); double newvalue=2*value; settablenum("mytablename",row,col,newvalue); } } Code:
treenode tablepointer=reftable("mytablename"); for(int row=1;row<=gettablerows(tablepointer);row++){ for(int col=1;col<=gettablecols(tablepointer);col++){ //you probably don't do something this simple, //but it's just an example that doubles each value double value=gettablenum(tablepointer,row,col); double newvalue=2*value; settablenum(tablepointer,row,col,newvalue); } } |
The Following 4 Users Say Thank You to Alex Christensen For This Useful Post: | ||
Tom David (07-15-2008) |
Thread | Thread Starter | Forum | Replies | Last Post |
[Suggesiton] UNDO function | KelvinHo | Gripes and Goodies | 10 | 05-23-2008 01:58 AM |
Print function | David Chan | Gripes and Goodies | 0 | 05-21-2008 09:38 PM |
Double load handling ASRS | Paul Dowling | Q&A | 8 | 05-06-2008 10:19 PM |
max() is a deprecated function; use maxof() instead! | Lolke Koopmans | Gripes and Goodies | 0 | 02-25-2008 02:45 AM |
Unable to move the view by left-click dragging? | Regan Blackett | Tips and Tricks | 0 | 08-03-2007 10:01 AM |