简体   繁体   English

C ++控制台程序的前端

[英]Front end for C++ console program

I am currently in the end stages of development of a console program in C++. 我目前处于C ++控制台程序开发的最后阶段。 The issue I am having is my program requires that the user be able indicate where they want to perform function on a large, dynamic grid (aprox 50x50). 我遇到的问题是我的程序要求用户能够指示他们要在大型动态网格(aprox 50x50)上执行功能的位置。 The console implementation I have designed is very clunky, and difficult to use. 我设计的控制台实现非常笨拙,并且难以使用。 It would also be nice for the user if I had a drop down box or similar functionality for IO. 如果我有一个下拉框或类似的IO功能,对用户来说也很好。

It was recommended to me that I design the front end in C# or HTML5. 建议我以C#或HTML5设计前端。 I have limited, basic experience with C#, and no experience with HTML5. 我对C#的基本经验有限,而对HTML5则没有经验。 I am also still relatively new to C++. 我还是C ++的新手。 I would appreciate being pointed in the right direction. 我希望能指出正确的方向。

If your program is written in a style like most source code management systems, your front-end can use the system function or process pipelines (alternatively good old popen ) to issue commands and deal with them. 如果您的程序是以大多数源代码管理系统一样的方式编写的,则您的前端可以使用系统功能或处理管道 (或者老式的popen )来发出命令并进行处理。 If you cannot do something like this you can have a look at your code and check out how tied the actual logic is with the representation of things on the command line. 如果您无法执行此类操作,则可以查看代码,并检查实际逻辑与命令行上的事物表示之间的联系。 If it deeply tied together (eg your compute() function pads strings to the correct length for printing), you need to refactor. 如果它紧密地绑在一起(例如您的compute()函数将字符串填充到正确的长度以进行打印),则需要进行重构。 If it isn't your probably can just build a GUI with any GUI tool-kit on top of the already existing code. 如果不是这样,您可能只需在现有代码之上使用任何GUI工具包构建一个GUI。

I will recommend you simple GUI. 我将向您推荐简单的GUI。 Creating GUI in the QT is very easy, there is a lot of basic tutorials. 在QT中创建GUI非常容易,有很多基本教程。 after download and install : http://qt.nokia.com/products/ there is directory called "example". 下载并安装后: http : //qt.nokia.com/products/有一个名为“ example”的目录。

Other solution for me is another application which will save data in some reasonable format like .xml and there you can load it in your program like ./MyComplicatedApplication MyData.xml 对我来说,其他解决方案是另一个应用程序,它将以某种合理的格式保存数据,例如.xml,您可以在其中将其加载到程序中,例如./MyComplicatedApplication MyData.xml。

I would not mess up with C#, why two different languages? 我不会搞砸C#,为什么要使用两种不同的语言? It will be harder in the maintenance. 维护起来会很困难。 Be aware that writing GUI in the QT is not really harder than in C# and it will be cross-platform code. 请注意,在QT中编写GUI并不比在C#中真正困难,它将是跨平台代码。

You could use a DataGridView in managed C++, the .NET API it's identical (for practical purpose) among languages. 您可以在托管C ++(。NET API)中使用DataGridView ,它在各种语言中是相同的(出于实际目的)。 DataGridView exposes a large array of methods/objects, just because it's a very useful/used interface. DataGridView公开了大量的方法/对象,仅因为它是一个非常有用/非常有用的接口。 So you could find it somewhat difficult, but the basic usage can be very simple. 因此,您可能会发现有些困难,但是基本用法可能非常简单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM