ATTENTION

This 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

Go Back   FlexSim Community Forum > FlexSim Software > Tips and Tricks
Downloads

Tips and Tricks Share helpful modeling ideas

  #1  
Old 06-24-2014
Vincent Bechard Vincent Bechard is offline
Consulting in Simulation
 
Join Date: Oct 2008
Location: Montréal (Canada)
Posts: 28
Downloads: 0
Uploads: 0
Thanks: 4
Thanked 41 Times in 13 Posts
Rep Power: 165
Vincent Bechard will become famous soon enoughVincent Bechard will become famous soon enough
Smile Open code editor with a double-click on FS treenodes

As the title says...

For developers working intensively with Tree views. If you have lots of Flexscript nodes that you need to edit, you can open code editor directly from a treeview by double-clicking of a FS node (with the "S" icon...). The only things you need to do:

1) Use any ModelLibrary OnModelOpen trigger, or use Tools | Model triggers | On Model Open
2) Put this code in the trigger:

Code:
treenode destination = node("VIEW:/standardviews/documentwindows/Tree>eventfunctions/OnClick");
string extracode = concat("if(clickcode()==DOUBLE_CLICK)\nif(switch_flexscript(selectedobject(c),-1)||comparetext(getnodename(selectedobject(c)),\"fsmacros\"))\n{treenode target = selectedobject(c);\nsetselectedobject(activedocumentnode(), ownerobject(target));\napplicationcommand(", strquote("codeeditor"),", target, 1);}");
if(stringsearch(getnodestr(destination), extracode,0)<0)
{
	setnodestr(destination, concat(getnodestr(destination), "\n", extracode));
	buildnodeflexscript(destination);
}
3) Save your model and re-open Flexsim... it is magic!

A simple trick that will delight developers.
__________________
Vincent Béchard, Eng., MASc.
Discrete Event Simulation Designer
SNC-Lavalin, Industrial Division
ca.linkedin.com/in/vincentbechard/

Last edited by Vincent Bechard; 03-04-2015 at 12:43 PM.
The Following 6 Users Say Thank You to Vincent Bechard For This Useful Post:
Steven Hamoen (06-24-2014)
  #2  
Old 03-04-2015
Vincent Bechard Vincent Bechard is offline
Consulting in Simulation
 
Join Date: Oct 2008
Location: Montréal (Canada)
Posts: 28
Downloads: 0
Uploads: 0
Thanks: 4
Thanked 41 Times in 13 Posts
Rep Power: 165
Vincent Bechard will become famous soon enoughVincent Bechard will become famous soon enough
Default

I updated the code in previous post. Users can double-click on a "fsmacros" node and use code editor. In addition to double-clicking on flexscript nodes!
__________________
Vincent Béchard, Eng., MASc.
Discrete Event Simulation Designer
SNC-Lavalin, Industrial Division
ca.linkedin.com/in/vincentbechard/
The Following 4 Users Say Thank You to Vincent Bechard For This Useful Post:
RalfGruber (03-05-2015)


Thread Thread Starter Forum Replies Last Post
Save and Restore Tabs in Code Editor AlanZhang User Development 1 08-04-2012 04:31 PM
Open _TD models directly from the Windows Explorer with double click Tom David Q&A 0 11-18-2009 09:55 AM
Add all open tabbed Trigger editor in V5 JMEngelhart Gripes and Goodies 1 08-14-2009 09:57 AM
Double click to execute the onpress function sophia yao Q&A 4 07-15-2008 08:53 PM
Things I like about v4.3 (autocompletion, billboards, shortcuts, relative media paths, code editor) Tom David Gripes and Goodies 1 03-28-2008 02:34 AM


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.