Calculator


peyro

Recommended Posts

Hello,

I have a HMI running in full screen, and I need to provide a calculator to the operator. There are two alternatives: 1) develop calculator in DAQ factory 2) run the windows calculator

I would like to ask a question on both alternatives:

For option 1) : is there any calculator already done that I can use? as you have a pop up keypad sample, to avoid reinvent the wheel!!!

For option 2) : if DAQfactory opens the windows calculator, is there a way to force the use to close it when done? I mean, I dont want the user to click on DAQ factory again and let the calculator program in the background, so when they need it again a new instance will be open and so on.

Thanks and regards

peyro

Link to comment
Share on other sites

1) there isn't one done, but you could create one yourself pretty easily. I believe there are some password entry samples that would show you how to create a keypad. The easiest way, though, would be to take a string entry dialog as an expression and then use the eval() function to calculate the result. The user would type in something like:

3+4

as a string, and then eval() would take that string and return 7, which you could then somehow display.

2) this part I'm not so sure about. There probably is using shellexecute(). There certainly is if you know how to code C++ and MFC, but you'd have an easier time just creating your own calculator in DAQFactory.

Link to comment
Share on other sites

  • 3 weeks later...

Wouldn't it be just as easy to make a button with a quick seq of system.shellexecute(calc.exe)?

I see he doesn't want the user to open multiple calculators.

Is there a force on-top switch?

Can you use [noclose] on external .exe's?

system.shellexecute("calc.exe", [noclose], [ontop])? ;)

Link to comment
Share on other sites

ShellExecute would work, but then you don't have much control over the other app. There is no noclose,ontop options. This is actually harder to pull off in windows than you'd think. You can pass some commands to the new program, like print or open, but I don't think on top is one of them. If you just need a basic calculator, you'd probably be better off just doing it in DF. It wouldn't take long to do. You can always just have the user enter the expression themselves as a string ("3+4.58 * 32") like they would in excel (without the opening =) and use evaluate() to come up with the answer.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.