問一下openvanilla寫一個範例程式的問題

0 views
Skip to first unread message

安仔

unread,
Feb 29, 2008, 10:36:46 PM2/29/08
to OpenVanilla
#include <stdio.h>
#include <Openvanilla/OpenVanilla.h>
#include <Openvanilla/OVLibrary.h>

class FoobarContext : public OVInputMethodContext {
public:
virtual int keyEvent(OVKeyCode* k, OVBuffer*, OVCandidate*,
OVService* s) {
char msg[256];
sprintf(msg, "%s", "我");
b->append(msg)->update();
s->notify(msg);
return 0;
}
};
當按下鍵盤後會到keyevent做時,我本來是要按下任何鍵,由b->append(msg)->update()這行輸出"我"這個字,可是輸不出
來,請問是要如何才能輸出"我"這個字?

Weizhong Yang

unread,
Mar 1, 2008, 10:11:01 AM3/1/08
to openv...@googlegroups.com
要用 send() 才會送出。

2008/3/1 安仔 <ericbe...@hotmail.com>:

安仔

unread,
Mar 2, 2008, 3:38:41 AM3/2/08
to OpenVanilla
#include <stdio.h>
#include <Openvanilla/OpenVanilla.h>
#include <Openvanilla/OVLibrary.h>

class FoobarContext : public OVInputMethodContext {
public:
virtual int keyEvent(OVKeyCode* k, OVBuffer*, OVCandidate*,
OVService* s) {
char msg[256];
sprintf(msg, "%s", "我");
b->append(msg)->update();
s->notify(msg);
b->send( );
return 0;
}
};
以上是我修改後的程式碼,我用記事本來寫,結果按下鍵盤任一鍵就會把記事本給關了,連"我"這個字都看不到><,請問我是那寫錯了嗎?
Reply all
Reply to author
Forward
0 new messages