• 今天无意中发现,在Google的搜索建议中,居然有自己的名字,难道我成名人了?

    恩,努力努力,把自己的搜索排名提高,做到名副其实,不搞竞价排名。

  • 上篇我们说到如何利用XML文件定义和描述Ribbon界面,从分工的意义上讲,其实那是UI设计师的活儿。作为程序员,更加专注的是如何对 Ribbon控件的消息进行响应,完成相应的业务逻辑。现在,该轮到程序员上场了!在Ribbon界面编辑完成的基础上,我们来看看如何利用 Windows Scenic Ribbon API处理各种控件消息,让Ribbon界面真正地投入使用。

      在前面一篇文章中,我们讨论了如何利用XML文件创建Ribbon控件,对控件进行排布和设置控件的缩放策略等等,可以说,这些工作都是UI设计师的任务。对程序员来说,更重要的是对控件的消息进行处理实现其业务逻辑。

      添加消息处理功能

       大家应该还记得,在本系列前面的文章中,我们创建了一个派生自IUIApplication的Ribbon界面宿主对象类CApplication,并 利用这个类完成了Ribbon界面的创建,初始化以及与Windows应用程序的集成。要对Ribbon控件的消息进行处理,我们还是要借助这个宿主对象 类。为了使得CApplication类具有控件消息处理的能力,我们需要修改它的定义,让它同时也从IUICommandHandler派生。而 IUICommandHandler类,则是Scenic Ribbon API提供给我们的控件消息处理类,只要CApplication从这个类派生,就具有了相应的控件消息的处理能力。

      为了对控件消息进行处理,我们修改CApplication类的定义如下:

    // 引入Scenic Ribbon API的头文件
    #include
    <uiribbon.h>
    // 引入编译生成的资源头文件
    #include
    "ribbonres.h"
    // 调用Windows API获得系统时间
    #include
    "windows.h"
    #include
    "stdio.h"

    IUIFramework
    * g_pFramework = NULL;
    // Ribbon界面宿主程序
    class CApplication
        :
    public CComObjectRootEx<CComMultiThreadModel>
            ,
    public IUIApplication  // 处理Ribbon界面的创建和初始化
            ,
    public IUICommandHandler // 处理Ribbon控件的消息

      然后,我们需要利用COM_INTERFACE_ENTRY宏定义COM_MAP,在CApplication类的定义中,添加:

    public:
        BEGIN_COM_MAP(CApplication)
              COM_INTERFACE_ENTRY(IUIApplication)
                      COM_INTERFACE_ENTRY(IUICommandHandler)
        END_COM_MAP()

       这样,Ribbon控件的消息就会发送到CApplication类,由CApplication类进行处理。在整个Scenic Ribbon API中,Ribbon控件消息的处理流程如下图所示。除了之前我们介绍的跟Ribbon界面创建和初始化相关的过程之外,为了完成控件消息,我们首先需 要为感兴趣的控件进行注册,这些工作都会在OnCreateCommand函数中完成。完成控件的注册后,当我们需要进行消息处理的控件有消息发生 时,IUIFramework就会将这些消息发送给CApplication,而我们就可以在CApplication类中对具体的消息进行处理。 Ribbon控件的消息主要分成两种:一种是来自控件的动作消息,比如按钮控件被点击,ComboBox的选择发生了变化等。这类消息都在Execute 函数中进行处理;另外一种是则对控件属性进行更新的消息,这类消息在UpdateProperty函数中进行处理。


    图1  Ribbon界面的消息处理流程

     

    VS2010与Win7共舞:响应Ribbon控件消息

  • 最近Twitter很火爆,Jakob Nielsen'也为如何提供更加用户友好的Twitter而做了三番五次的重新设计:In fact, the shorter it is, the more important it is to design text for usability.

    Summary:
    We made a timeline message more punchy, credible, and viral through 5 rounds of redesign.

    A few days ago, I posted the announcement of our next usability conferences to Nielsen Norman Group's timeline on Twitter (@NNgroup).

    I don't have all the guidelines for stream-based postings yet, because we're still conducting usability studies (particularly of B2B users, like my audience). But, based on the user sessions I've observed already, I put this posting through 5 rounds of iterative design.

    1st Design

    Announcing LAS VEGAS and BERLIN as the venues for our biggest usability conference of the year http://bit.ly/UsabilityWeek

    Good: City names are highlighted, drawing the eye.

    Bad: Starts with the non-information-carrying word "announcing." Of course it's an announcement — otherwise I wouldn't be posting it...

    Remember that users tend to read only the first few characters as they scan down a list. Make them count.

    2nd Design

    LAS VEGAS and BERLIN are the venues for our biggest usability conference of the year http://bit.ly/UsabilityWeek

    Good: Frontloading attractive keywords makes this version more scannable.

    Bad: We lost the sense of news that "announcing" implied in the previous version.

    Because many companies molest their poor followers with repeat postings about the same event, users have become somewhat hardened against event promotions.

    3rd Design

    LAS VEGAS (October) and BERLIN (November) are the venues for our biggest usability conference of the year http://bit.ly/UsabilityWeek

    Good: Adding the months highlights that the conferences are coming up soon, regaining us some of that sense of news. Also, specificity is always a plus: it makes users feel like they're getting concrete and useful info, instead of the blather that characterizes so many B2B websites.

    Bad: This draft Tweet is 133 characters, leaving only 7 characters for users who want to retweet. This isn't enough to add the customary 11-character attribution (RT@NNgroup), which is a must if we're going to benefit from the viral effect of our followers' followers being made aware of our feed.

    (Keeping tweets below 130 characters won't be a long-term guideline because Twitter is redesigning to remove the source attributions from the main message content for repostings. Until this redesign goes live, however, it's best to leave slack in your original postings if you expect followers to share them.)

    4th Design

    LAS VEGAS (October) and BERLIN (November): venues for our biggest usability conference of the year http://bit.ly/UsabilityWeek

    Good: Saved 6 characters by replacing "are the" with a colon. Full sentences aren't necessary for such short content, which users are scanning anyway. We're not trying to be the next Hemingway in a tweet.

    Also: Fragments fine here. MS Word's squiggles frowning at you? Ignore them.

    (Alternatively, I could have used a shorter URL shortcut, but there are benefits to giving people an idea of where the link will lead.)

    5th Design

    LAS VEGAS (October) and BERLIN (November): venues for our biggest usability conference ever http://bit.ly/UsabilityWeek

    Good: Changed the awkward "biggest of the year" to the punchier "biggest ever." In addition to being shorter, "biggest ever" provides two additional benefits:

    • It's a more compelling argument for why readers should care and click through to see the full program
    • Growing during a bad recession is evidence of our strength and promises a positive experience, which is appealing to audiences who are tired of doom and gloom

    This year, I'm producing 33 full-day seminars in Vegas compared with 31 in 2008, so I could have tried to squeeze in a reference to "6.5% growth since last year." But even though exact numbers have higher credibility than broader assertions, a tweet should be highly focused and not try to make multiple points

    .

    Expanding by 6.5% during a recession is what evolutionary scientists call a "costly signal." That is, it's a way of communicating both the healthy status of usability in general and the high interest in our conference, which can't be faked: it costs real money to book more lecture rooms and fly in more speakers. Only a healthy peacock can grow a big tail.

    Costly signals are more credible than unsupported boasts — whether you want to attract peahens or Web users. I was particularly interested in communicating a strong position last week, because we're currently recruiting new usability staff. The best people will consider leaving their current jobs only if they're confident of the new company's prospects.

    When to Tweet

    My last design decision was when to post the message to the Twitter timeline. My preferred tweeting time is 9:01 a.m. because it encompasses working hours from California to the U.K. and thus reaches a majority of our customers. (It's best to post a minute after the hour so you'll be listed on top of anybody who naively sets their software to release postings at exactly 9:00.)

    In this case, however, German readers and others in continental Europe were particularly important, because we're going to Berlin for the first time. Thus, I pulled the posting time forward to 7:51 a.m. Pacific time, which is 4:51 p.m. in Germany and will still reach Californians who check Twitter during breakfast.

    One of the big downsides of stream-based communication compared to email newsletters is the highly ephemeral nature of the postings: Once they scroll off the first screen, they're essentially 6 feet under.

    A look at clickthrough statistics for links posted to Twitter vs. those circulated in email newsletters shows a drastically steeper decay function: lots of clicks the first few minutes, and then almost none. In contrast, email continues to generate clicks for days as people work their way through their inboxes.

    • Clickthrough decay: Twitter time passes 10 times faster than email time.

    This makes it hard to reach an international customer base on Twitter, and makes it important to tweak the posting time relative to each topic's main target. (It's also one of the many reasons I continue to believe that email is a more powerful medium.)

    Text is a UI

    It's a common mistake to think that only full-fledged graphical user interfaces count as interaction design and deserve usability attention. As our earlier research has shown, URLs and email both contribute strongly to the Internet user experience and thus require close attention to usability to enhance the profitability of a company's Internet efforts.

    In fact, the shorter it is, the more important it is to design text for usability.

     

  • 在上一篇文章中,我们介绍了如何利用Windows Scenic Ribbon API为一个普通的Windows应用程序添加Ribbon界面。其中,我们只是简单地添加了一个Ribbon面板和一个按钮控件,还没有实现任何的具体 功能。这就像我们创建了一个Ribbon容器,等着我们将各种Ribbon控件装进去并对控件的各种消息进行处理,以实现相应的业务逻辑。

      在这一篇文章中,我们就来介绍如何向Ribbon面板添加各种Ribbon控件并实现控件的合理排布。

       微软在自己大量用户体验研究的基础上,同时积极汲取用户对第一代Ribbon界面的反馈,在第二代Scenic Ribbon界面中,提供了更加丰富的Ribbon控件,使得Ribbon界面的控件更加丰富。通过这些Ribbon控件的灵活组合应用,能够应对各种应 用程序对Ribbon界面控件的需要。下面我们就来介绍一下如何为Ribbon界面添加各种Ribbon控件并对这些控件进行排列布局。

      

      添加Ribbon界面添加应用程序菜单

       除了Ribbon面板,Ribbon界面的最大革新之处就是它的应用程序菜单。在Ribbon界面中,我们可以在Ribbon面板上布置一些常用的命令 功能,而对于一些不太常用的功能,比如文件打开关闭,系统设置等等,都可以在应用程序菜单中进行。Ribbon界面中应用程序菜单的定义非常简单,跟添加 按钮控件相似,我们需要先在XML文件的命令部分添加菜单中需要的各个菜单项:

    <!—应用程序菜单项-->
        
    <Command Name="FileMenu"
                 Symbol
    ="cmdFileMenu"
                 Id
    ="25000" />
        
    <!—为最长使用文档列表定义控件 -->
        
    <Command Name="cmdMRUList"
                 Symbol
    ="cmdMRUList"
                 Id
    ="25050"/>
        
    <Command Name="cmdMRUItems"
                 Symbol
    ="cmdMRUItems"
                 Id
    ="25051"/>
        
    <Command Name="cmdNew"
                 Symbol
    ="cmdNew"
                 Comment
    ="New"
                 Id
    ="25001"
                 LabelTitle
    ="New">
            
    <Command.LargeImages>
              
    <Image Source="NewL.bmp"/>
            
    </Command.LargeImages>
        
    </Command>
        
    <Command Name="cmdOpen"
                 Symbol
    ="cmdOpen"
                 Comment
    ="Open"
                 Id
    ="25002"
                 LabelTitle
    ="Open"/>
        
    <Command Name="cmdSave"
                 Symbol
    ="cmdSave"
                 Comment
    ="Save"
                 Id
    ="25003"
                 LabelTitle
    ="Save"
                 TooltipTitle
    ="Save tooltip title"
                 TooltipDescription
    ="Save tooltip description."/>
        
    <Command Name="cmdPrint"
                 Symbol
    ="cmdPrint"
                 Comment
    ="Print"
                 Id
    ="25004"
                 LabelTitle
    ="Print" />
        
    <Command Name="cmdExit"
                 Symbol
    ="cmdExit"
                 Comment
    ="Exit"
                 Id
    ="25005"
                 LabelTitle
    ="Exit" />


  •  

    1.活着一天,就是有福气,就该珍惜。当我哭泣我没有鞋子穿的时候,我发现有人却没有脚。
    2.
    宁可自己去原谅别人,莫让别人来原谅你。
    3.
    世界原本就不是属于你,因此你用不着抛弃,要抛弃的是一切的执著。万物皆为我所用,但非我所属。
    4.
    别人可以违背因果,别人可以害我们,打我们,毁谤我们。可是我们不能因此而憎恨别人,为什么?我们一定要保有一颗完整的本性和一颗清净的心。
    5.
    你有你的生命观,我有我的生命观,我不干涉你。只要我能,我就感化你。如果不能,那我就认命。
    6.如果你准备结婚的话,告诉你一句非常重要的哲学名言「你一定要忍耐包容对方的缺点,世界上没有绝对幸福圆满的婚姻,幸福只是来自于无限的容忍与互相尊重。
    7.我的财富并不是因为我拥有很多,而是我要求的很少。
    8.不是某人使我烦恼,而是我拿某人的言行来烦恼自己。
    9.活在别人的掌声中,是禁不起考验的人。
    10.如果你能每天呐喊二十一遍「我用不着为这一点小事而烦恼」,你会发现,你心里有一种不可思议的力量,试试看,很管用的。
    11.若能一切随他去,便是世间自在人。
    12.感谢上苍我所拥有的,感谢上苍我所没有的。
    13.来是偶然的,走是必然的。所以你必须,随缘不变,不变随缘。
    14.别人永远对,我永远错,这样子比较没烦恼。
    15.愚痴的人,一直想要别人了解他。有智慧的人,却努力的了解自己。
    16.对于不可改变的事实,除了认命以外,没有更好的办法了。
    17.其实爱美的人,只是与自己谈恋爱罢了。
    18.说一句谎话,要编造十句谎话来弥补,何苦呢?
    19.当你用烦恼心来面对事物时,你会觉得一切都是业障,世界也会变得丑陋可恨。
    20.根本不必回头去看咒骂你的人是谁?如果有一条疯狗咬你一口,难道你也要趴下去反咬他一口吗?
    21.狂妄的人有救,自卑的人没有救。
    22.你什么时候放下,什么时候就没有烦恼。
    23.人之所以痛苦,在于追求错误的东西。
    24.与其说是别人让你痛苦,不如说是自己的修养不够。
    25.命运负责洗牌,但是玩牌的是我们自己!
    26.过错是暂时的遗憾,而错过则是永远的遗憾!

    你可以拒绝学习,但你的竞争对手不会!——杰克·韦尔奇