KeyState


iziBasicでハードキーの状態をリアルタイムにチェックできるようにする部品です。
キーを押し続けても、正しい結果を返します。

It is the part which can check the state of the hard key in iziBasic in real time.
It return a right result even if I continue pushing the key.


■PPコード

{KeyState 2007/6/19 Tuka}

{$code appl,FUWA,code,100}
program Fuwafuwa;
{$i PalmAPI.pas}
{$i PPlib.pas}

type iBasFunType=function(S:string):string;
var	iBasCallPP:iBasFunType;
	C:integer;
	W:Uint32;
	S:string;

function CallPP(S:string):string;
begin
	W:=KeyCurrentState;
	S:='';
	C:=0;
	while C<=31 do
	begin
		if (W mod 2) = 0 then S:=S+'0' else S:=S+'1';
		W:=W div 2;
		C:=C+1;
	end;
	CallPP:=S;
end;

begin
	iBasCallPP:=CallPP;
end.
太字の部分を
組み込みたいアプリの情報に書き換えます。

FUWA はクリエイターIDです。
100 はコードのリソースIDです。
Fuwafuwa はアプリ名です。


PP code
I transfer it to information of the application that wants to incorporate a bold-faced part.

"FUWA" is creator ID.
"100" is resource ID of the code.
"Fuwafuwa" is application name.


左からの位置キー
1
Power key
2
Page-up
3
Page-down
4
App #1
5
App #2
6
App #3
7
App #4
8
Button on cradle
9
Antenna "key"
10
Contrast key
11
JogDial: Push key
12
JogDial: Back key
13
Capture Button
14
VoiceRec Button
15
Capture-Half Button
16
?
17
5-way rocker up?
18
5-way rocker down?
19
5-way rocker left
20
5-way rocker right
21
5-way rocker center/press
22
?
23
?
24
?
25
?
26
?
27
?
28
?
29
JogDial Up
30
JogDial Down
31
Audio Remote Controller
32
Hardware Keyboard
二進数形式でキーの状態を返します。

キーが押されていれば「1」、押されていなければ「0」を返します。

1文字目が「1」なら、電源キーが押されています。
2文字目が「1」なら、上キーが押されています。
12文字目が「1」なら、ジョグダイヤルのバックキーが押されています。




It return a binary number form for the state of the key.
A key gives back "1" if pushed,"0" if not pushed.

If the first character is "1", a power key is pushed.
If the second character is "1", a page-up key is pushed.
If the twelfth character is "1", the back key to jog dial is pushed.








■iziBasicコード

A$=CALLPP$(100)
I$=CHAR$(A$,1):IF I$="1" LET E=-1

CALLPP$(100)の「100」はリソースIDです。
ここでは、1文字目が「1」なら(電源キーが押されていれば)、Eに-1を代入しています。

iziBasic code
"100" of CALLPP$(100) is resource ID.
If the first character is "1", this code substitutes -1 for E.(if a power key is pushed)
I can check the information of other keys equally, too.




パーム用データベース研究所

Database Institute for palms