【问题标题】:Creating buttons that event handle with a visual c++ program使用可视化 C++ 程序创建事件处理的按钮
【发布时间】:2011-10-21 09:05:23
【问题描述】:

我会尽力解释这一点。我目前有一个程序,目前只需单击我创建的一些按钮图形即可在菜单中循环。我也在使用 CE 模拟器来模拟程序的运行情况。我为设备创建了一个皮肤,并添加了按钮(参见下面的 xml),当它们被按下时会做出指示。我基本上想让实际的程序按钮成为静态的,并使皮肤按钮做程序按钮会做的事情(循环通过菜单等)。我只想让皮肤按钮相应地起作用。抱歉,这真的很模糊,我将不胜感激,谢谢。

   <?xml version="1.0" encoding="UTF-8"?>
<skin>
  <view titleBar="SalusSdk" displayWidth="480" displayHeight="272" displayPosX="147" displayPosY="103" displayDepth="16" mappingImage="down.png" normalImage="defaultskin.png" downImage="Up.png">


          <button
            toolTip="Button one"
            onClick="  DOWN:Key_LeftShift
                       Key_Z
                       0x00000015
                       UP: Key_LeftShift
                       Key_A"
            onPressAndHold="Key_B"
            mappingColor="0xFFF200"
        />


<button
            toolTip="Button two"
            onClick="  DOWN:Key_LeftShift
                       Key_Z
                       0x00000015
                       UP: Key_LeftShift
                       Key_A"
            onPressAndHold="Key_B"
            mappingColor="0x3F48CC"
        />

<button
            toolTip="Button three"
            onClick="  DOWN:Key_LeftShift
                       Key_Z
                       0x00000015
                       UP: Key_LeftShift
                       Key_A"
            onPressAndHold="Key_B"
            mappingColor="0x22B14C"
        />

<button
            toolTip="Button four"
            onClick="  DOWN:Key_LeftShift
                       Key_Z
                       0x00000015
                       UP: Key_LeftShift
                       Key_A"
            onPressAndHold="Key_B"
            mappingColor="0xFFAEC9"
        />

<button
            toolTip="Button five"
            onClick="  DOWN:Key_LeftShift
                       Key_Z
                       0x00000015
                       UP: Key_LeftShift
                       Key_A"
            onPressAndHold="Key_B"
            mappingColor="0xFF8000"
        />



<button
            toolTip="Button five"
            onClick="  DOWN:Key_LeftShift
                       Key_Z
                       0x00000015
                       UP: Key_LeftShift
                       Key_A"
            onPressAndHold="Key_B"
            mappingColor="0xA349A4"
        />     

</view>
</skin>

【问题讨论】:

  • 我还应该提到,我有一个 XML 文件,其中包含所有按钮和菜单,其中存储了事件处理程序。

标签: xml visual-c++ windows-ce device-emulation


【解决方案1】:

您基本上需要您的应用程序来处理由皮肤按钮生成的击键。在您的 skin.xml 中,所有按钮都会生成相同的击键,因此您需要对其进行更改,以使它们独一无二。我首先使用常规键盘连接按键处理和测试,然后使用皮肤按钮进行匹配。

【讨论】:

  • 好的,请原谅我,但我在试图理解该怎么做时遇到了一些麻烦。我是否将该“onClick”事件以十六进制格式分配给某个键盘键,即“Home”?然后在我的实际 c++ 代码中为事件添加击键?
猜你喜欢
  • 1970-01-01
  • 2013-03-05
  • 2017-07-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-03-12
  • 2015-03-02
  • 2012-08-17
相关资源
最近更新 更多