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 |
|
Downloads |
Q&A Using Flexsim and building models |
#1
|
|||
|
|||
Are there functions / keyboard shortcuts for controlling the Flexsim debugger?
Hi,
I am wondering if there are functions for controlling the Flexsim debugger, i.e. next line, step-into, continue and stop simulation clock. I would want to use these commands with the keyboard instead of having to press the buttons with the mouse. I tried to look at the debug() function, but did not get it working and I am not sure if that is the way it is supposed to be used anyhow. I know how to create the keyboard shortcuts (see https://www.flexsim.com/community/fo...board+shortcut) if there are functions that can control the debug. Anyone who knows if this can be done? Thank you! Kind regards, Axel |
#2
|
|||
|
|||
To make it clearer I tried to use the debug command like below. I called this function from the perspective view/eventfunctions/onKeyDown node. The shortcuts are working as the prints work, but the debug instructions throw me "exception: Exception caught in flexscript execution of MODEL:/Tools/UserCommands/customKeyboardShortcuts/code line 8 instruction 12. Discontinuing execution."
Code:
/**customKeyboardShortcuts*/ //pf(lastkeydown());pr(); treenode debugObject = parnode(1); if(lastkeydown()){ //key pressed? switch (lastkeydown()){ case 113: //p.e. F2-Key pt("F2");pr(); debug(DEBUG_STEP); break; //F3 key case 114: pt("F3"); pr(); debug(DEBUG_STEP_INTO); break; //F4 key case 115: pt("F4");pr(); debug(DEBUG_CONTINUE); break; case 116: pt("F5");pr(); debug(DEBUG_STOP_SIMULATION); break; case 117: pt("F6");pr(); debug(DEBUG_STOP); break; } } |
#3
|
|||
|
|||
You need to pass in the code node as the second parameter, and that will change depending on which code you're debugging. Also your method requires you to click into the perspective view when you want to start stepping through.
I've asked that we add it to the debugger. |
The Following 4 Users Say Thank You to Jason Lightfoot For This Useful Post: | ||
RalfGruber (07-24-2015) |
#4
|
|||
|
|||
Thank you Jason,
That makes sense. Do you know of some good way to get the current code node, i.e. the one that the debugger is active in? Or how can I get it? Is there a way to have a onKeyTrigger in the editor instead of the perspective view? That way the onKeyTrigger would be fired in the correct node more easily. Thank you! That would make the debugger easier to use! Kind regards, Axel |
#5
|
|||
|
|||
From the perspective view you'd have to scan through the Views:active>documents/code entries and find the code editor window that had the active debugger and then find the object that was focused on.
From the debugger, the onkeyDown would need to be in a number of view levels of the GUI to detect which had your mouse focus - and then the path to the objectfocus code node pointer of the code editor will be changing for each event. Both are just a little messy/clunky - hopefully our developers can come up with something better. |
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
Axel Kohonen (07-24-2015) |
#7
|
|||
|
|||
Jason, will you insert this function in the next release of Flexsim 7.7?
Without using perspective, Axel, you can edit OnKeyUp with the switch case directly in the CodeEditor GUI saved in VIEW:/standardviews/code/CodeEditor. |
The Following User Says Thank You to Alessio Merlo For This Useful Post: | ||
Axel Kohonen (08-02-2015) |
#8
|
|||
|
|||
Not for me to say - sorry - but they seem to always do a good job of putting things in if they can. If I hear back I'll post here or maybe one of the guys will.
|
#9
|
|||
|
|||
Thank you Alessio and Jason,
Alessio, I cannot seem to find the onKeyUp within the View:/standardview/code/codeEditor. I assume it would be in the eventfunctions node, but there is no onKeyUp node there. Where did you find it (I am using Flexsim 7.5.2)? Also, I tried to add the node, but it disappears when I save, close and reopen the model. Is there a way to save the node so that it stays there also when you save and close and reopen the model? Thank you! Axel |
#10
|
|||
|
|||
You can use create a module to make the change 'stick'.
|
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
Axel Kohonen (08-03-2015) |
#11
|
|||
|
|||
Thank you Jason,
You mean as mentioned in these posts? https://www.flexsim.com/community/fo...=create+module and https://www.flexsim.com/community/fo...ight=bitbucket If that is the case then I guess I need to maintain my changes in later versions, right? Until the functionality is added in the official release at least. Thank you! Axel |
Tags |
debugging |
Thread | Thread Starter | Forum | Replies | Last Post |
Problem with redefined keyboard keys | Danny Pavan | Q&A | 2 | 06-21-2010 09:26 AM |
COM Object for Controlling Flexsim | Anthony Johnson | User Development | 6 | 02-25-2009 11:43 AM |
Flexsim Debugger | Anthony Johnson | Gripes and Goodies | 6 | 02-06-2009 05:37 AM |
Controlling Flexsim Remotely | Anthony Johnson | Wiki Articles | 2 | 01-02-2009 12:36 PM |
Change Flexsim keyboard shortcut | AlanZhang | Q&A | 1 | 12-03-2008 02:41 PM |