Qizhen's profileLabVIEWPhotosBlogListsMore Tools Help

Blog


    用 LabVIEW 编写 Wizard 类型的应用程序 2 (LabVIEW 6.1 ~ 7.1)

     

    四、Tab 控件+事件处理结构

         LabVIEW 6.1 的出现才第一次大大简化了 Wizard 界面风格程序的编写。LabVIEW 6.1增加了两个非常重要的新特性,一个是Tab控件,一个是事件处理结构。
        有了Tab控件,就可以把 Wizard 中每一页需要的控件分别放在 Wizard 不同的页面上,切换 Tab 的活动页面也就显示了该页面上相应的控件。
        事件处理结构的应用更为广泛。有了它,编程者就不需要再添加额外的代码来监视每个控件的状态改变以及鼠标、键盘等的操作了。
     
        这种利用Tab控件和事件处理结构编写的 Wizard 风格界面程序的方法现在仍然被广泛使用着,下面这个链接就是一个采用这种方法编写的软件:
        它的功能是把一个 C 语言开发的仪器驱动程序转换为 LabVIEW 下的驱动程序。程序虽然是我编写的,但版权属于NI公司,所以不能把程序源代码公开给大家。
     
        这种方法也有它的弊端。因为整个 Wizard 界面会用到的所有控件都集中在同一个 VI 上,这个主VI就可能特别庞大:界面可能有数十个控件,程序框图上的事件处理更为复杂,有近百个事件也不作为奇。如果需要对程序作修改,要找到相应的事件框就已经很困难了,要确定这个改动是否会影响程序的其他部分就更为困难了。
        图1是我编写的一个Tab控件风格的向导型程序,它的主VI中的事件结构中,有近百个事件需要处理。对这样的程序,想找到一个相应的时间都很麻烦,处理好事件之间的关系就更困难了。
        Tab 控件+事件处理结构的架构虽然大大简化了 Wizard 界面风格程序的编写,但是这样的程序很难对他的代码进行更细致的模块划分,并把模块的私用数据隐藏起来。为了使大型 Wizard 程序有更好的可读性,可维护性,还需找到一种更好的架构。
     
     http://byfiles.storage.live.com/y1pIcO_924THocaqWAuvlifSgMTolcmyd-jouBopDKYw9O1LbUa2Qu3hWJuvAlzX2VUdBk9aa9WA0Y
    图1:使用Tab控件的向导型程序,事件结构中众多事件

    相关文章:

     

    Comments (3)

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    colinwrote:
    您是高手啊~~~~崇拜!!!!
    Aug. 14
    Qizhen Ruanwrote:
    我去看了一下,这个 blog 确实做得满漂亮的。不过它的作者不是会更清楚它是如何做出来的吗:)
    我的想法是,作这样一个 blog 首先由有素材,要有哪些漂亮的图片。
    你现在把它上面的图片选中,Ctrl+C,再到自己的帖子上 Ctrl+V。也可以做出和它差不多的页面了 :D
    Aug. 14
    冰蓝wrote:
    先给你一个BLOG,很漂亮,人也很漂亮啊!嘿嘿!我不知道在哪给你留言。就随便找了个地方。我想问问你他们怎么弄得。为什么问你呢,缘分!http://loveeven0401.spaces.live.com/
    Aug. 12

    Trackbacks (1)

    The trackback URL for this entry is:
    http://ruanqizhen.spaces.live.com/blog/cns!5852D4F797C53FB6!1627.trak
    Weblogs that reference this entry