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
|
|||
|
|||
Adding Flexsim custom shortcut keys
Hey all.
Has anyone dabbled in creating custom shortcut keys? What I am looking for is a way to use a keyboard shortcut to execute a bit of Flexscript code. Can this be done, and if not, can it be added to the development list? Have fun simulating everyone. Best regards Christian |
#2
|
||||
|
||||
You can use a usercommand to add custom shortcut keys. It could look like this:
Code:
if(lastkeydown())//key pressed? { switch (lastkeydown())//which key? { case 113: //p.e. F2-Key //your code break; case 114: //p.e. F3-Key //your code break; } } Attention: Flexsim has a lot of keyboard shortcuts. This could collide with your own shortcut keys. |
The Following 4 Users Say Thank You to Carsten Seehafer For This Useful Post: | ||
Jörg Vogel (03-18-2013) |
#3
|
||||
|
||||
P.S.: This is a link of shortcut keys but it's not up-to-date (Version 5)
http://www.flexsim.com/community/for...ight=shortcuts |
#4
|
|||
|
|||
Is it possible to upload an example with this shortkey command in it?
I'm strugling to get the OnKeyDown code into a perspective view to zoom-in with a key (F2). Kind regards, Koen van Thiel |
#5
|
|||
|
|||
CharCode instead of KeyCode possible ?
Is it possible to work with charCode instead of keyCode? I want to create a zoom function, when I press and hold a button it has to zoom in.
Does anybody know what the code is to do this? for keyCode I already have: if(iskeydown(102)) //Numpad 6 if (eq(lastkeydown(),102)) //Numpad 6 kind regards, Koen van Thiel |
#7
|
||||
|
||||
Use pd() to print the lastkeydown() to the output console. Then you can check for that specific key by its keycode.
|
The Following User Says Thank You to Phil BoBo For This Useful Post: | ||
Jörg Vogel (12-11-2013) |
#8
|
|||
|
|||
Define Views and access them from dashboard
I've been trying to do something similar by creating Views and selecting them with buttons in a custom dashboard. For example: Close-up, Right side, Left side.
But I can't find a Command that would allow to select a predefined View. Is there one? Any other way to do this? Thanks |
#9
|
||||
|
||||
gui button to open a View
The code I am using in my Model Control GUI to open View 1.
On Press: // SET THE VIEW TO THE CAPTURED VIEW (DON'T FORGET THAT THE GUI NEEDS Apalettewindow ATTRIBUTE) // STOP THE FLY PATH flystop(); // POINTER TO CURRENT VIEW treenode curview = NULL; curview = node("/Tools/PerspViews/1",model()); // SET THE VIEW executefsnode(curview,curview,0,0,0); // SCREENREFESH repaintall(); As written in the comments it is important, that the GUI needs a “palettwindow” attribute. This is just a node in the tree like viewfocus, spatialx, OnClose, etc. Just add a node in the tree and call it “palettwindow”.
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions." |
The Following 4 Users Say Thank You to Tom David For This Useful Post: | ||
Sebastian Hemmann (12-11-2013) |
#10
|
|||
|
|||
I should have indicated that I didn't create a GUI the old fashioned way. I created a Dashboard (new with version 7).
I put the exact above code in the OnPress code of my button on my dashboard (except I changed the 1 for the name of my view). I've inserted a node called "palettwindow" into my dashboard node. Nothing happens when I press on the button. Any ideas? |
#11
|
||||
|
||||
The code in Tools/PerspViews sets the view on the active document window. When you are clicking in your Dashboard, the dashboard window is the active document window.
|
The Following User Says Thank You to Phil BoBo For This Useful Post: | ||
Tom David (12-12-2013) |
Thread | Thread Starter | Forum | Replies | Last Post |
Adding some Collision Spheres | Sebastian Hemmann | Q&A | 3 | 02-14-2011 07:30 AM |
Problem with redefined keyboard keys | Danny Pavan | Q&A | 2 | 06-21-2010 09:26 AM |
Adding a Line Trend in the GUI | JMEngelhart | Tips and Tricks | 1 | 03-08-2010 04:04 AM |
Excel Short Cut Keys | Brandon Peterson | Tips and Tricks | 1 | 09-30-2009 08:04 AM |
Change Flexsim keyboard shortcut | AlanZhang | Q&A | 1 | 12-03-2008 02:41 PM |