简单程序的GUI开发 [英] GUI Development for a simple Program

查看:72
本文介绍了简单程序的GUI开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试为程序开发GUI,并已下载"Ultimate ++"软件来尝试执行此操作.我将使用GUI来控制安捷伦实验室仪器,从而使实验室测试更加高效和省时.

我想让用户选择/输入频率,额定功率,一个保存的Resgister文件,并查看Spectrum Analzer屏幕的屏幕截图.从这里可以保存图像,用户可以选择具体位置.

我已经进入Ultimate ++并创建了布局,但是最大和最重要的问题是我不确定如何正确编码这些功能,因为我以前从未使用过该软件,也不熟悉该软件.关注的最大问题是添加/使用与安捷伦仪器兼容的正确的文库.

我使用的库是:

Hey All,

I am attempting to develop a GUI for a program and have downloaded the "Ultimate++" Software to attempt at doing this. I will be using the GUI to control Agilent lab instruments so as to make lab testing more efficient and time effective.

I want to have the user select/enter a Frequency, Power Rating, A Saved Resgister File, and View a screenshot of the Spectrum Analzer screen. From here the image can be saved and the user can select where specifically.

I have already gone into Ultimate++ and created the layout, but the biggest and most important issue is that I am not sure how to properly code these functions as I have never used the software before and am not well versed with it. The largest issue of concern is adding/using the correct library compatible with the Agilent instruments.

The libraries I use are:

#include <"stdafx.h">
#include <"visa.h">
#include <iostream>
#include <fstream>
using namespace std;



编译并调试了初始设置后,它会读取以下错误:致命错误C1083:无法打开包含文件:''stdafx.h":没有这样的文件或目录..."

我应该如何解决这些错误/更改代码以允许项目进行编译?

我也不完全确定如何按照指定的方式对按钮的功能进行编程.从SCPI命令到C ++转换编程,频率如下所示:

viPrintf(v5182_signal_generator,:Freq 1400 MHz \ n");

如果我以前在MVC ++中使用的库不能再使用,则不确定如何对功能按钮/实用程序进行编程.如果是这种情况,我需要开发自己的驱动程序来做到这一点吗?

由于我有限的编程经验,从一开始就承担这个项目是一个挑战,因此任何输入/反馈/建议都将不胜感激!

在此先感谢!

以下是代码文档:
main.cpp:



After compiling and debugging the initial setup it was reading errors like: " fatal error C1083: Cannot open include file: ''stdafx.h'': No such file or directory..."

How should I fix these errors/change the code to allow for the project to compile?

I also am not completely sure how to go about programming the fucntionality of a button to operate as it should be by designation. From SCPI commands to C++ conversion programming a frequency would look like this:

viPrintf(v5182_signal_generator, ":Freq 1400 MHz\n");

and if the library I used previously in MVC++ can no longer be used I am unsure how to go about programming a function button/utility. If this is the case would I need to develop my own driver to do this?

Taking on this project was a challenge from the start with my limited programming experience so any input/feedback/recommendations would be greatly appreciated!

Thanks in Advance!

Here are the code documents:
main.cpp:

#include <stdafx.h>
#include <visa.h>
#include <iostream>
#include <fstream>
using namespace std;



maTest::maTest()
{
    CtrlLayout(*this, "Window title");
}

GUI_APP_MAIN
{
    maTest().Run();
}


Test.h:


Test.h:

#ifndef _maTest_maTest_h
#define _maTest_maTest_h

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

#define LAYOUTFILE <maTest/maTest.lay>
#include <CtrlCore/lay.h>

class maTest : public WithmaTestLayout<TopWindow> {
public:
    typedef maTest CLASSNAME;
    maTest();
};

#endif


布局文件:
maTest.lay


Layout File:
maTest.lay

class maTestDlg : public WithmaTestLayout<TopWindow> {
    typedef maTestDlg CLASSNAME;

public:
    maTestDlg();
};

maTestDlg::maTestDlg()
{
    CtrlLayout(*this, "");
}

推荐答案

报价:

设置它正在读取错误,例如:致命错误C1083:无法打开包含文件:" stdafx.h":没有这样的文件或目录..."

After compiling and debugging the initial setup it was reading errors like: " fatal error C1083: Cannot open include file: ''stdafx.h'': No such file or directory..."


嗯,这很不言自明,编译器无法在您作为项目一部分指定的任何目录中找到stdafx.h文件.


Well that''s rather self-explanatory, the compiler can''t find the stdafx.h file in any directories you specified as part of your project.

报价:

如果是这种情况,我需要开发自己的驱动程序来做到这一点吗?

If this is the case would I need to develop my own driver to do this?


通常不,您需要查看硬件规格,以了解如何将命令传送到设备.这可能是TCP/IP套接字连接或某种串行连接(取决于硬件).

[edit]
顺便说一句,stdafx通常是由MS IDE(Visual Studio)创建(默认)的预编译头的名称.如果您没有将其作为Ultimate ++的来源的一部分,则可能不应该将其包括在内(换句话说,如果您自己没有生成它,则不要#include它).


Usually no, you need to look at the hardware specs to see how you can trasmit the commands over to the piece of equipment. It''s likely a TCP/IP socket connection or a serial connection of some sort (hardware dependent).

[edit]
By the way, stdafx is usually the name of the precompiled header made (by default) by the MS IDE (Visual Studio). If you did not include it as part of your source for Ultimate++, it probably shouldn''t be included (in another words, if you didn''t generate it yourself, don''t #include it).


您可能会受益于 Ultimate ++入门 [ ^ ]
You might benefit from this Getting Started With Ultimate++[^]


IMO,在2012年,您不需要第三方UI工具包(*)即可购买99%的软件;您会发现它们是为解决小问题或添加并非总是有用的功能而创建的;如果出现崩溃和错误(不是MFC没有错误),对它们的支持将不是理想的.

MFC提供了足够的功能来创建强大的"(gasp)用户界面,该界面将很容易被大多数用户使用.

看看《用户体验指南》(1)和所有MFC示例(2)

了解MFC(和附件Win32).

(*),但真正特定的项目除外.
(1) Windows用户体验交互准则 [ MFC功能包示例 [
IMO, in 2012, you don''t need third party UI toolkit (*) for 99% of the software out there; you will find that they were created to fix small issues or add features that are not always useful; and support for them will be less than ideal if there are crash and bugs with them (not that MFC is bugless).

MFC offers enough features to be able to create "powerful" (gasp) User Interface that will be easy enough to be used by the majority of the users.

Have a look at the User Experience Guideline (1) and all the MFC samples (2)

Learn MFC (and accessory Win32).

(*) except for really specific items.
(1)Windows User Experience Interaction Guidelines[^]
(2) MFC Feature Pack samples[^]


这篇关于简单程序的GUI开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆