Авторизироваться
  • Страница 1 из 3
  • 1
  • 2
  • 3
  • »
Модератор форума: ADMIN, Nextik  
помогите новичку!
30.11.2009 в 23:41 Сообщение #1
maestrodan
Непонятливый
Пользователи
Сообщений: 21
Награды: 0
Репутация: 0
Offline
Люди, я всего 5 дней программирую на мидлете, помогите написать телефонную книгу, защищённую кодом!
Я вот написа сам две версии проги:
phonebook2_1:не работает отображение списка номеров, точнее, работает не коректно.
phonebook2:не компилируется, пишет ошибку в фрагменте, отвечающем за отображения списка имён
2 другие-предыдущая версия проги, она работает, за исключением смены пароля(глюки какие-то, сначала работало, но потом перестало, хоть я и не трогал больше фраменты, отвечающие за это)
просмотрите проги, и обьясните ошибки, пожалуйста!
также добавляю сами проекты.
Прикрепления: phonebookfiles.zip (57.8 Kb)
30.11.2009 в 23:42 Сообщение #2
maestrodan
Непонятливый
Пользователи
Сообщений: 21
Награды: 0
Репутация: 0
Offline
вот 2_1

program phonebook;
uses call;
type peop=record
name:string;
number:string;
em:string;
ind:integer;
end;
var code,r:recordstore;
i,textfield,book,new,chpas,ext,index,nam,num,mail,k,p,back,del,all,one,inf,look:integer;
c3,clicked,play,c4,c:command;
cod:string;
s1:peop;
punkt:array[1..1000] of integer;
begin
r:=openrecordstore('names');
textField:= formAddTextField('Введите код', '', 20, TF_email);
c3:=createcommand('ok',CM_ok,1);
showform;
addcommand(c3);
while (getClickedCommand <>c3) do
delay(100);
cod:= formGetText(textField);
code:=openrecordstore('code');
k:=getrecordstoresize(code);
clearform;
if k=0 then
index:=addRecordStoreEntry(code,cod);
if cod<>readrecordstoreentry(code,1) then
halt
else
repeat
showmenu('тел.cправочник',CH_IMPLICIT);
new:= menuAppendStringimage('Новая запись',loadimage('/new.png'));
look:=menuappendstringimage('См.записи',loadimage('/book.png'));
book:= menuAppendStringimage('Поиск',loadimage('/book.png'));
del:=menuappendstringimage('Стереть',loadimage('/del.png'));
chpas:= menuAppendStringimage('Сменить пароль',loadimage('/newimage.png'));
inf:=menuappendstringimage('О проге',loadimage('/inf.png'));
ext:=menuappendstringimage('Выход',loadimage('/ext.png'));
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=inf then
begin
showAlert('Инфо', 'Разработчик-Белоусов Даниил г.Херсон 2009 год версия 1.0.2', loadImage('/inf.png'),ALERT_INFO);
playAlertSound;
c:= createCommand('ok', CM_OK, 1);
addCommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
end;
if menugetselectedindex=look then
repeat
showmenu('Записи',CH_IMPLICIT);
k:=getrecordstoresize®;
if k<>0 then
punkt[1]:=menuappendstring(readrecordstoreentry(r,1));
for i:=1 to k do
if readrecordstoreentry(r,i*3+1)<>'' then
punkt[i+1]:=menuappendstring(readrecordstoreentry(r,i*3+1));
back:=menuappendstring('назад');
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=punkt[i] then
repeat
showmenu(readrecordstoreentry(r,i),CH_IMPLICIT);
num:=menuappendstring(readrecordstoreentry(r,i+1));
mail:=menuappendstring(readrecordstoreentry(r,i+2));
back:=menuappendstring('назад');
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=num then
p:=phone(readrecordstoreentry(r,i+1));
until menugetselectedindex=back;
until menugetselectedindex=back;
if menuGetSelectedIndex=chpas then
begin
deleterecordstore('code');
code:=openrecordstore('code');
showtextbox('см.пароль','',20,tf_email);
c4:= createCommand('сменить', CM_SCREEN, 1);
addCommand(c4);
repeat
delay(100);
until getClickedCommand <> emptyCommand;
index:=addRecordStoreEntry(code,gettextboxstring);
closerecordstore(code);
end;
if menugetselectedindex=new then
begin
showtextbox('введите имя(Eng)','',200,tf_any);
c:=createcommand('save',cm_screen,1);
addcommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
s1.name:=gettextboxstring;
index:= addRecordStoreEntry(r,s1.name);
showtextbox('введите номер','',200,tf_numeric);
c:=createcommand('save',cm_screen,1);
addcommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
s1.number:=gettextboxstring;
index := addRecordStoreEntry(r,s1.number);
showtextbox('введите E-mail','',200,tf_email);
c:=createcommand('save',cm_screen,1);
addcommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
s1.em:=gettextboxstring;
index := addRecordStoreEntry(r,s1.em);
end;
if menugetselectedindex=del then
repeat
showmenu('удаление',ch_implicit);
all:=menuappendstring('все');
one:=menuappendstring('по имени');
back:=menuappendstring('назад');
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=all then
begin
showAlert('Удаление', 'записи удалены', loadImage('/del.png'),ALERT_INFO);
playAlertSound;
c:= createCommand('ok', CM_OK, 1);
addCommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
k:=getrecordstoresize®;
for i:=1 to k do
deleterecordstoreentry(r,i);
end;
if menugetselectedindex=one then
begin
k:=getrecordstoresize®;
textField:= formAddTextField('Введите имя', '', 20, TF_ANY);
c3:=createcommand('ok',CM_ok,1);
showform;
addcommand(c3);
while (getClickedCommand <>c3) do
delay(100);
for i:=1 to k do
begin
if readrecordstoreentry(r,i)=formgettext(textfield) then
begin
deleterecordstoreentry(r,i);
deleterecordstoreentry(r,i+1);
deleterecordstoreentry(r,i+2);
end;
end;
showAlert('удаление', 'запись удалена', loadImage('/del.png'),ALERT_INFO);
playAlertSound;
c:= createCommand('ok', CM_OK, 1);
addCommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
clearform;
end;
until menugetselectedindex=back;
if menugetselectedindex=book then
repeat
begin
showmenu('Критерий поиска',CH_IMPLICIT);
nam:=menuappendstring('по имени');
num:=menuappendstring('по номеру');
back:=menuappendstring('назад');
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=nam then
begin
k:=getrecordstoresize®;
textField:= formAddTextField('Введите имя', '', 20, TF_ANY);
c3:=createcommand('ok',CM_ok,1);
showform;
addcommand(c3);
while (getClickedCommand <>c3) do
delay(100);
for i:=1 to k do
begin
if readrecordstoreentry(r,i)=formgettext(textfield) then
repeat
showmenu(readrecordstoreentry(r,i),CH_IMPLICIT);
num:=menuappendstring(readrecordstoreentry(r,i+1));
mail:=menuappendstring(readrecordstoreentry(r,i+2));
back:=menuappendstring('назад');
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=num then
p:=phone(readrecordstoreentry(r,i+1));
clearform;
until menugetselectedindex=back;
end;
end;
if menugetselectedindex=num then
begin
k:=getrecordstoresize®;
textField:= formAddTextField('Введите номер', '', 20, TF_numeric);
c3:=createcommand('ok',CM_ok,1);
showform;
addcommand(c3);
while (getClickedCommand <>c3) do
delay(100);
for i:=1 to k do
begin
if readrecordstoreentry(r,i)=formgettext(textfield) then
repeat
showmenu(readrecordstoreentry(r,i-1),CH_IMPLICIT);
num:=menuappendstring(readrecordstoreentry(r,i));
mail:=menuappendstring(readrecordstoreentry(r,i+1));
back:=menuappendstring('назад');
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=num then
p:=phone(readrecordstoreentry(r,i));
clearform;
until menugetselectedindex=back;
end;
end;
end;
until menugetselectedindex=back;
until menuGetSelectedIndex=ext;
closerecordstore®;
end.

30.11.2009 в 23:43 Сообщение #3
maestrodan
Непонятливый
Пользователи
Сообщений: 21
Награды: 0
Репутация: 0
Offline
вот 2

program phonebook;
uses call;
type peop=record
name:string;
number:string;
em:string;
ind:integer;
end;
var code,r:recordstore;
i,textfield,book,new,chpas,ext,index,nam,num,mail,k,p,back,del,all,one,inf,look:integer;
c3,clicked,play,c4,c:command;
cod:string;
s1:peop;
punkt:array[1..1000] of integer;
begin
r:=openrecordstore('names');
textField:= formAddTextField('Введите код', '', 20, TF_email);
c3:=createcommand('ok',CM_ok,1);
showform;
addcommand(c3);
while (getClickedCommand <>c3) do
delay(100);
cod:= formGetText(textField);
code:=openrecordstore('code');
k:=getrecordstoresize(code);
clearform;
if k=0 then
index:=addRecordStoreEntry(code,cod);
if cod<>readrecordstoreentry(code,1) then
halt
else
repeat
showmenu('тел.cправочник',CH_IMPLICIT);
new:= menuAppendStringimage('Новая запись',loadimage('/new.png'));
book:= menuAppendStringimage('Поиск',loadimage('/book.png'));
look:=menuappendstringimage('Записи',loadimage('/book.png'));
del:=menuappendstringimage('Стереть',loadimage('/del.png'));
chpas:= menuAppendStringimage('Сменить пароль',loadimage('/newimage.png'));
inf:=menuappendstringimage('О проге',loadimage('/inf.png'));
ext:=menuappendstringimage('Выход',loadimage('/ext.png'));
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menuGetSelectedIndex=ext then halt;
if menugetselectedindex=inf then
begin
showAlert('Инфо', 'Разработчик-Белоусов Даниил г.Херсон 2009 год версия 1.0.2', loadImage('/inf.png'),ALERT_INFO);
playAlertSound;
c:= createCommand('ok', CM_OK, 1);
addCommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
end;
if menugetselectedindex=look then
repeat
k:=getrecordstoresize® div 3;
if readrecordstoreentry(r,1)<>'' then
punkt[1]:=menuappendstring(readrecordstoreentry(r,1));
for i:=1 to k do
if readrecordstoreentry(r,i+1)<>'' then
punkt[i+1]:=menuappendstring(readrecordstoreentry(r,i*3));
back:=menuappendstring('назад');
showmenu('Записи',ch_implicit);
play:=createcommand('Выбор',cm_screen,1);
addcommand(play);
repeat
delay(100);
clicked:=getclickedcommand;
until clicked=play
if menugetselectedindex=punkt[i] then
repeat
showmenu(readrecordstoreentry(r,i),CH_IMPLICIT);
num:=menuappendstring(readrecordstoreentry(r,i+1));
mail:=menuappendstring(readrecordstoreentry(r,i+2));
back:=menuappendstring('назад');
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=num then
p:=phone(readrecordstoreentry(r,i+1));
clearform;
until menugetselectedindex=back;
until menugetselectedindex=back;
if menuGetSelectedIndex=chpas then
begin
deleterecordstore('code');
code:=openrecordstore('code');
showtextbox('см.пароль','',20,tf_email);
c4:= createCommand('сменить', CM_SCREEN, 1);
addCommand(c4);
repeat
delay(100);
until getClickedCommand <> emptyCommand;
index:=addRecordStoreEntry(code,gettextboxstring);
closerecordstore(code);
end;
if menugetselectedindex=new then
begin
showtextbox('введите имя(Eng)','',200,tf_any);
c:=createcommand('save',cm_screen,1);
addcommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
s1.name:=gettextboxstring;
index:= addRecordStoreEntry(r,s1.name);
showtextbox('введите номер','',200,tf_numeric);
c:=createcommand('save',cm_screen,1);
addcommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
s1.number:=gettextboxstring;
index := addRecordStoreEntry(r,s1.number);
showtextbox('введите E-mail','',200,tf_email);
c:=createcommand('save',cm_screen,1);
addcommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
s1.em:=gettextboxstring;
index := addRecordStoreEntry(r,s1.em);
end;
if menugetselectedindex=del then
repeat
showmenu('удаление',ch_implicit);
all:=menuappendstring('все');
one:=menuappendstring('по имени');
back:=menuappendstring('назад');
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=all then
begin
k:=getrecordstoresize®;
for i:=1 to k do
deleterecordstoreentry(r,i);
end;
if menugetselectedindex=one then
begin
k:=getrecordstoresize®;
textField:= formAddTextField('Введите имя', '', 20, TF_ANY);
c3:=createcommand('ok',CM_ok,1);
showform;
addcommand(c3);
while (getClickedCommand <>c3) do
delay(100);
for i:=1 to k do
begin
if readrecordstoreentry(r,i)=formgettext(textfield) then
begin
deleterecordstoreentry(r,i);
deleterecordstoreentry(r,i+1);
deleterecordstoreentry(r,i+2);
end;
end;
clearform;
end;
until menugetselectedindex=back;
if menugetselectedindex=book then
repeat
begin
showmenu('Критерий поиска',CH_IMPLICIT);
nam:=menuappendstring('по имени');
num:=menuappendstring('по номеру');
back:=menuappendstring('назад');
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=nam then
begin
k:=getrecordstoresize®;
textField:= formAddTextField('Введите имя', '', 20, TF_ANY);
c3:=createcommand('ok',CM_ok,1);
showform;
addcommand(c3);
while (getClickedCommand <>c3) do
delay(100);
for i:=1 to k do
begin
if readrecordstoreentry(r,i)=formgettext(textfield) then
repeat
showmenu(readrecordstoreentry(r,i),CH_IMPLICIT);
num:=menuappendstring(readrecordstoreentry(r,i+1));
mail:=menuappendstring(readrecordstoreentry(r,i+2));
back:=menuappendstring('назад');
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=num then
p:=phone(readrecordstoreentry(r,i+1));
clearform;
until menugetselectedindex=back;
end;
end;
if menugetselectedindex=num then
begin
k:=getrecordstoresize®;
textField:= formAddTextField('Введите номер', '', 20, TF_numeric);
c3:=createcommand('ok',CM_ok,1);
showform;
addcommand(c3);
while (getClickedCommand <>c3) do
delay(100);
for i:=1 to k do
begin
if readrecordstoreentry(r,i)=formgettext(textfield) then
repeat
showmenu(readrecordstoreentry(r,i-1),CH_IMPLICIT);
num:=menuappendstring(readrecordstoreentry(r,i));
mail:=menuappendstring(readrecordstoreentry(r,i+1));
back:=menuappendstring('назад');
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=num then
p:=phone(readrecordstoreentry(r,i));
clearform;
until menugetselectedindex=back;
end;
end;
end;
until menugetselectedindex=back;
until menuGetSelectedIndex=ext;
closerecordstore®;
end.

30.11.2009 в 23:45 Сообщение #4
maestrodan
Непонятливый
Пользователи
Сообщений: 21
Награды: 0
Репутация: 0
Offline
вот первая версия

program phonebook;
uses call;
type peop=record
name:string;
number:string;
em:string;
ind:integer;
end;
var code,r:recordstore;
i,textfield,book,new,chpas,ext,index,nam,num,mail,k,p,back,del,all,one,inf:integer;
c3,clicked,play,c4,c:command;
cod:string;
s1:peop;
begin
r:=openrecordstore('names');
textField:= formAddTextField('Введите код', '', 20, TF_email);
c3:=createcommand('ok',CM_ok,1);
showform;
addcommand(c3);
while (getClickedCommand <>c3) do
delay(100);
cod:= formGetText(textField);
code:=openrecordstore('code');
k:=getrecordstoresize(code);
clearform;
if k=0 then
index:=addRecordStoreEntry(code,cod);
if cod<>readrecordstoreentry(code,1) then
halt
else
repeat
showmenu('тел.cправочник',CH_IMPLICIT);
new:= menuAppendStringimage('Новая запись',loadimage('/new.png'));
book:= menuAppendStringimage('Поиск',loadimage('/book.png'));
del:=menuappendstringimage('Стереть',loadimage('/del.png'));
chpas:= menuAppendStringimage('Сменить пароль',loadimage('/newimage.png'));
inf:=menuappendstringimage('О проге',loadimage('/inf.png'));
ext:=menuappendstringimage('Выход',loadimage('/ext.png'));
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menuGetSelectedIndex=ext then halt;
if menugetselectedindex=inf then
begin
showAlert('Инфо', 'Разработчик-Белоусов Даниил г.Херсон 2009 год версия 1.0.1', loadImage('/inf.png'),ALERT_INFO);
playAlertSound;
c:= createCommand('ok', CM_OK, 1);
addCommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
end;
if menuGetSelectedIndex=chpas then
begin
deleterecordstore('code');
code:=openrecordstore('code');
showtextbox('см.пароль','',20,tf_email);
c4:= createCommand('сменить', CM_SCREEN, 1);
addCommand(c4);
repeat
delay(100);
until getClickedCommand <> emptyCommand;
index:=addRecordStoreEntry(code,gettextboxstring);
closerecordstore(code);
end;
if menugetselectedindex=new then
begin
showtextbox('введите имя(Eng)','',200,tf_any);
c:=createcommand('save',cm_screen,1);
addcommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
s1.name:=gettextboxstring;
index:= addRecordStoreEntry(r,s1.name);
showtextbox('введите номер','',200,tf_numeric);
c:=createcommand('save',cm_screen,1);
addcommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
s1.number:=gettextboxstring;
index := addRecordStoreEntry(r,s1.number);
showtextbox('введите E-mail','',200,tf_email);
c:=createcommand('save',cm_screen,1);
addcommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
s1.em:=gettextboxstring;
index := addRecordStoreEntry(r,s1.em);
end;
if menugetselectedindex=del then
repeat
showmenu('удаление',ch_implicit);
all:=menuappendstring('все');
one:=menuappendstring('по имени');
back:=menuappendstring('назад');
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=all then
begin
showAlert('Удаление', 'записи удалены', loadImage('/del.png'),ALERT_INFO);
playAlertSound;
c:= createCommand('ok', CM_OK, 1);
addCommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
k:=getrecordstoresize®;
for i:=1 to k do
deleterecordstoreentry(r,i);
end;
if menugetselectedindex=one then
begin
k:=getrecordstoresize®;
textField:= formAddTextField('Введите имя', '', 20, TF_ANY);
c3:=createcommand('ok',CM_ok,1);
showform;
addcommand(c3);
while (getClickedCommand <>c3) do
delay(100);
for i:=1 to k do
begin
if readrecordstoreentry(r,i)=formgettext(textfield) then
begin
deleterecordstoreentry(r,i);
deleterecordstoreentry(r,i+1);
deleterecordstoreentry(r,i+2);
end;
end;
showAlert('удаление', 'запиль удалена', loadImage('/del.png'),ALERT_INFO);
playAlertSound;
c:= createCommand('ok', CM_OK, 1);
addCommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
clearform;
end;
until menugetselectedindex=back;
if menugetselectedindex=book then
repeat
begin
showmenu('Критерий поиска',CH_IMPLICIT);
nam:=menuappendstring('по имени');
num:=menuappendstring('по номеру');
back:=menuappendstring('назад');
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=nam then
begin
k:=getrecordstoresize®;
textField:= formAddTextField('Введите имя', '', 20, TF_ANY);
c3:=createcommand('ok',CM_ok,1);
showform;
addcommand(c3);
while (getClickedCommand <>c3) do
delay(100);
for i:=1 to k do
begin
if readrecordstoreentry(r,i)=formgettext(textfield) then
repeat
showmenu(readrecordstoreentry(r,i),CH_IMPLICIT);
num:=menuappendstring(readrecordstoreentry(r,i+1));
mail:=menuappendstring(readrecordstoreentry(r,i+2));
back:=menuappendstring('назад');
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=num then
p:=phone(readrecordstoreentry(r,i+1));
clearform;
until menugetselectedindex=back;
end;
end;
if menugetselectedindex=num then
begin
k:=getrecordstoresize®;
textField:= formAddTextField('Введите номер', '', 20, TF_numeric);
c3:=createcommand('ok',CM_ok,1);
showform;
addcommand(c3);
while (getClickedCommand <>c3) do
delay(100);
for i:=1 to k do
begin
if readrecordstoreentry(r,i)=formgettext(textfield) then
repeat
showmenu(readrecordstoreentry(r,i-1),CH_IMPLICIT);
num:=menuappendstring(readrecordstoreentry(r,i));
mail:=menuappendstring(readrecordstoreentry(r,i+1));
back:=menuappendstring('назад');
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=num then
p:=phone(readrecordstoreentry(r,i));
clearform;
until menugetselectedindex=back;
end;
end;
end;
until menugetselectedindex=back;
until menuGetSelectedIndex=ext;
closerecordstore®;
end.

01.12.2009 в 11:52 Сообщение #5
12121
Программист
Проверенные
Сообщений: 357
Награды: 4
Репутация: 290
Offline
Если бы ты разбил на процедуры/функции найти ошибки было бы легче. А если бы добавил немного комментариев помочь было бы проще.
Может после удаления 1 записи надо сдвигать остальные?
01.12.2009 в 12:48 Сообщение #6
maestrodan
Непонятливый
Пользователи
Сообщений: 21
Награды: 0
Репутация: 0
Offline
спасибо, про последнее я как-то и не подумал...
на процедуры, конечно, проще будет, так и сделаю...
комменты для меня писать сложновато, но попробую
03.12.2009 в 22:52 Сообщение #7
maestrodan
Непонятливый
Пользователи
Сообщений: 21
Награды: 0
Репутация: 0
Offline
вот, разбил прогу на процедуры

program phonebook;
uses call;
type peop=record
name:string;
number:string;
em:string;
ind:integer;
end;
var code,r:recordstore;
i,j,textfield,book,new,chpas,ext,index,nam,num,mail,k,p,back,del,all,one,inf,look,back1:integer;
c3,clicked,play,c4,c:command;
cod:string;
s1:peop;
punkt:array[1..1000] of integer;

procedure lookp;
begin
repeat
showmenu('Записи',CH_IMPLICIT);
k:=getrecordstoresize® div 3; {добавление пунгктов меню-имён из телефонной книги, хранящихся в хранилище данных}
if k<>0 then
punkt[1]:=menuappendstring(readrecordstoreentry(r,1));
for i:=1 to k do
if readrecordstoreentry(r,i*3+1)<>'' then
punkt[i+1]:=menuappendstring(readrecordstoreentry(r,i*3+1));
back:=menuappendstring('назад');
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
for i:=1 to k do
if menugetselectedindex=punkt[i] then
repeat
showmenu(readrecordstoreentry(r,i),CH_IMPLICIT);
num:=menuappendstring(readrecordstoreentry(r,i+1));
mail:=menuappendstring(readrecordstoreentry(r,i+2));
back1:=menuappendstring('назад');
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=num then
p:=phone(readrecordstoreentry(r,i+1));
until menugetselectedindex=back1;
until menugetselectedindex=back;
clearform;
end;

procedure infp;
begin
showAlert('Инфо', 'Разработчик-Белоусов Даниил г.Херсон 2009 год версия 1.0.2', loadImage('/inf.png'),ALERT_INFO);
playAlertSound;
c:= createCommand('ok', CM_OK, 1);
addCommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
end;

procedure chpasp;
begin
deleterecordstoreentry(code,1);
showtextbox('см.пароль','',20,tf_email);
c4:= createCommand('сменить', CM_SCREEN, 1);
addCommand(c4);
repeat
delay(100);
until getClickedCommand <> emptyCommand;
index:=addRecordStoreEntry(code,gettextboxstring);
closerecordstore(code);
clearform;
end;
procedure newp;
begin
showtextbox('введите имя(Eng)','',200,tf_any);
c:=createcommand('save',cm_screen,1);
addcommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
s1.name:=gettextboxstring;
index:= addRecordStoreEntry(r,s1.name);
showtextbox('введите номер','',200,tf_numeric);
c:=createcommand('save',cm_screen,1);
addcommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
s1.number:=gettextboxstring;
index := addRecordStoreEntry(r,s1.number);
showtextbox('введите E-mail','',200,tf_email);
c:=createcommand('save',cm_screen,1);
addcommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
s1.em:=gettextboxstring;
index := addRecordStoreEntry(r,s1.em);
end;


procedure delp;
begin
repeat
showmenu('удаление',ch_implicit);
all:=menuappendstring('все');
one:=menuappendstring('по имени');
back:=menuappendstring('назад');
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=all then
begin
showAlert('Удаление', 'записи удалены', loadImage('/del.png'),ALERT_INFO);
playAlertSound;
c:= createCommand('ok', CM_OK, 1);
addCommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
k:=getrecordstoresize®;
for i:=1 to k do
deleterecordstoreentry(r,i);
end;
if menugetselectedindex=one then
begin
k:=getrecordstoresize®;
textField:= formAddTextField('Введите имя', '', 20, TF_ANY);
c3:=createcommand('ok',CM_ok,1);
showform;
addcommand(c3);
while (getClickedCommand <>c3) do
delay(100);
for i:=1 to k do
begin
if readrecordstoreentry(r,i)=formgettext(textfield) then
begin
deleterecordstoreentry(r,i);
deleterecordstoreentry(r,i+1);
deleterecordstoreentry(r,i+2);
end;
end;
showAlert('удаление', 'запись удалена', loadImage('/del.png'),ALERT_INFO);
playAlertSound;
c:= createCommand('ok', CM_OK, 1);
addCommand©;
repeat
delay(100);
until getclickedcommand<>emptycommand;
clearform;
end;
until menugetselectedindex=back;
end;

procedure bookp;
begin
repeat
showmenu('Критерий поиска',CH_IMPLICIT);
nam:=menuappendstring('по имени');
num:=menuappendstring('по номеру');
back:=menuappendstring('назад');
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=nam then
begin
k:=getrecordstoresize®;
textField:= formAddTextField('Введите имя', '', 20, TF_ANY);
c3:=createcommand('ok',CM_ok,1);
showform;
addcommand(c3);
while (getClickedCommand <>c3) do
delay(100);
for i:=1 to k do
begin
if readrecordstoreentry(r,i)=formgettext(textfield) then
repeat
showmenu(readrecordstoreentry(r,i),CH_IMPLICIT);
num:=menuappendstring(readrecordstoreentry(r,i+1));
mail:=menuappendstring(readrecordstoreentry(r,i+2));
back1:=menuappendstring('назад');
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=num then
p:=phone(readrecordstoreentry(r,i+1));
clearform;
until menugetselectedindex=back1;
end;
end;
if menugetselectedindex=num then
begin
k:=getrecordstoresize®;
textField:= formAddTextField('Введите номер', '', 20, TF_numeric);
c3:=createcommand('ok',CM_ok,1);
showform;
addcommand(c3);
while (getClickedCommand <>c3) do
delay(100);
for i:=1 to k do
begin
if readrecordstoreentry(r,i)=formgettext(textfield) then
repeat
showmenu(readrecordstoreentry(r,i-1),CH_IMPLICIT);
num:=menuappendstring(readrecordstoreentry(r,i));
mail:=menuappendstring(readrecordstoreentry(r,i+1));
back1:=menuappendstring('назад');
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=num then
p:=phone(readrecordstoreentry(r,i));
clearform;
until menugetselectedindex=back1;
end;
end;
until menugetselectedindex=back;
end;

begin
r:=openrecordstore('names');
textField:= formAddTextField('Введите код', '', 20, TF_email);
c3:=createcommand('ok',CM_ok,1);
showform;
addcommand(c3);
while (getClickedCommand <>c3) do
delay(100);
cod:= formGetText(textField);
code:=openrecordstore('code');
k:=getrecordstoresize(code);
clearform;
if k=0 then
index:=addRecordStoreEntry(code,cod);
if cod<>readrecordstoreentry(code,1) then
halt
else
repeat
showmenu('тел.cправочник',CH_IMPLICIT);
new:= menuAppendStringimage('Новая запись',loadimage('/new.png'));
look:=menuappendstringimage('См.записи',loadimage('/book.png'));
book:= menuAppendStringimage('Поиск',loadimage('/book.png'));
del:=menuappendstringimage('Стереть',loadimage('/del.png'));
chpas:= menuAppendStringimage('Сменить пароль',loadimage('/newimage.png'));
inf:=menuappendstringimage('О проге',loadimage('/inf.png'));
ext:=menuappendstringimage('Выход',loadimage('/ext.png'));
play:= createCommand('Выбор', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked:= getClickedCommand;
until clicked = play;
if menugetselectedindex=inf then
infp;
if menugetselectedindex=look then
lookp;
if menugetselectedindex=chpas then
chpasp;
if menugetselectedindex=new then
newp;
if menugetselectedindex=del then
delp;
if menugetselectedindex=book then
bookp;
until menuGetSelectedIndex=ext;
closerecordstore®;
end.

04.12.2009 в 13:02 Сообщение #8
admin
Admin
Администраторы
Сообщений: 244
Награды: 2
Репутация: 594
Offline
Плз не выкладывай простыней, скажи именно, как ты хочешь, чтоб ты заходил - вводил пароль и попал в мидлет. в мидлете можно было создавать телефонную книжку, или он брла бы номера из телефонной книги тела?
05.12.2009 в 09:21 Сообщение #9
maestrodan
Непонятливый
Пользователи
Сообщений: 21
Награды: 0
Репутация: 0
Offline
Ну да, хочу, чтоб для входа в мидлет надо было ввести пароль(но чтоб потом в мидлете его можно было поменять), и чтоб в самом мидлете создавать телефонную книжку...
у меня неадекватно работает отображение списка имён, пароль чего-то не меняется, и при выборе команды "назад" постоянно переходит в меню поиска...
05.12.2009 в 13:49 Сообщение #10
12121
Программист
Проверенные
Сообщений: 357
Награды: 4
Репутация: 290
Offline
Исправил изменение пароля. Он же в отдельном хранилище? Проще всего удалять все хранилище целиком.
определись будут у тебя хранилища открыты все время или только когда делаешь запись/чтение
Прикрепления: 111.zip (10.0 Kb)
  • Страница 1 из 3
  • 1
  • 2
  • 3
  • »
Поиск: