Показать сообщение отдельно
Старый 08.11.2012, 18:29   #4
Deport
Оператор ЭВМ
 
Аватар для Deport
 
Регистрация: 06.03.2009
Сообщений: 38
Написано 3 полезных сообщений
(для 3 пользователей)
Сообщение Ответ: Вопрос по командам

Не совсем уверен но может вам поможет мой образец для тестов

program sys;
var x: integer;
str:string;
ext,del,ok: Command;
Begin

ext := CreateCommand('start', cm_exit, 1);
del := CreateCommand('del', cm_screen, 1);
AddCommand(ext);
AddCommand(del);
repeat
ok:=GetClickedCommand;
if GetKeyPressed = KE_KEY1 then str:=''+str+'1';
if GetKeyPressed = KE_KEY2 then str:=''+str+'2';
if GetKeyPressed = KE_KEY3 then str:=''+str+'3';
if GetKeyPressed = KE_KEY4 then str:=''+str+'4';
if GetKeyPressed = KE_KEY5 then str:=''+str+'5';
if GetKeyPressed = KE_KEY6 then str:=''+str+'6';
if GetKeyPressed = KE_KEY7 then str:=''+str+'7';
if GetKeyPressed = KE_KEY8 then str:=''+str+'8';
if GetKeyPressed = KE_KEY9 then str:=''+str+'9';
if GetKeyPressed = KE_KEY0 then str:=''+str+'0';


x := Length(str);
if ok=del then begin
if x>0 then str:=Copy(str,0,x-1);
if x=0 then playAlertSound;
end;

SetColor(0, 0, 0);
FillRect(0, 0, GetWidth, GetHeight);
SetColor(255, 255, 255);
DrawText(''+str+'', 0, 0);
Repaint;
delay(100);

until (x>0) and (ok = ext);
RemoveCommand(ext);
RemoveCommand(del);
str:='Вы выбрали номер: '+str+'';
SetColor(0, 0, 0);
FillRect(0, 0, GetWidth, GetHeight);
SetColor(255, 255, 255);
DrawText(''+str+'', 0, 0);
Repaint;
delay(-1);
end.
(Offline)
 
Ответить с цитированием