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 > User Development
FAQ Downloads Calendar Search Mark Forums Read

User Development User developed add-ons to Flexsim

View Poll Results: Is this functionality something you would find useful?
I would use it all of the time 3 50.00%
I would use it sometimes 3 50.00%
I would not use it 0 0%
Voters: 6. You may not vote on this poll

Reply
 
Thread Tools Display Modes
  #1  
Old 06-08-2008
AlanZhang's Avatar
AlanZhang AlanZhang is offline
Flexsim Super Moderator
 
Join Date: Aug 2007
Location: CA
Posts: 289
Downloads: 64
Uploads: 0
Thanks: 88
Thanked 91 Times in 47 Posts
Rep Power: 221
AlanZhang is a jewel in the roughAlanZhang is a jewel in the roughAlanZhang is a jewel in the rough
Default InputBox in Flexsim script

A missing (as far as I know) but very useful feature in Flexsim script is a simple InputBox. You may wonder why we need a simple InputBox since we can create all kinds of GUIs. Well, if you use createview to display a window, the code after the createview will continue to execute and sometimes you do not want that.

In the attached model, I created user commands to show a simple InputBox and get the user inputs as a string. Flexsim DLL is used to create the commands.

Two user commands are provided. Basically they works the same but using slightly different methods to create. The dllinputbox command using parstr to passing strings as parameters. According to a post by Anthony(http://www.flexsim.com/community/for...command+string), you can use parstr to parse strings but you may get memory leaking. Keeping that in mind, the other user command, inputbox, uses treenodes to hold strings so there is definitely no memory leaking problem. So you should use inputbox command to be safe. Both user commands returns a treenode (returned as a double since user command can only return double) which stores the user inputs as a string. Then you have to use gets(tonode(inputbox())) to get the result.

The attached DLL InputBox.zip includes the demo model and the dll file. Unzip the files to the same directory. The demo model has a script window open. Simply click the Execute button and type something in the inputbox. The retured user inputs will be printed out in the Output window. If you want user input numbers, you can use stringtonum command to cast the results to numbers.

The attached DLL Project.zip includes a Visual Studio 2008 project which has all C++ source code.

The InputBox is not perfect yet since when the InputBox is open, the Flexsim main window still response to mouse actions. I do not know how to fix it. Maybe Anthony or some other guy in Flexsim can do something about it.
Attached Files
File Type: zip DLL InputBox.zip (134.3 KB, 415 views)
File Type: zip DLL Project.zip (204.7 KB, 421 views)
__________________
Best,
Alan
Reply With Quote
The Following 9 Users Say Thank You to AlanZhang For This Useful Post:
AJ Bobo (06-09-2008), Brandon Peterson (06-09-2008), Cliff King (06-09-2008), Graca Silva (04-08-2015), Lars-Olof Leven (06-09-2008), Leandro Filippi (04-08-2015), Steven Hamoen (06-10-2008), Tom David (06-08-2008), Yongbin Kim (09-30-2010)
  #2  
Old 04-08-2015
Graca Silva
Guest
 
Posts: n/a
Downloads: 11
Uploads: 0
Default

Hello! That sounds like a useful tool, is it possible to make these available again please?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic script generation: Good Example with a User Command Naresh Yamani Tips and Tricks 2 05-16-2008 06:54 PM


All times are GMT -6. The time now is 01:14 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.