Показать сообщение отдельно

  #13  
Старый 08.01.2010, 14:12
Markus_13
Познающий
Регистрация: 19.02.2009
Сообщений: 83
Провел на форуме:
181715

Репутация: 50
Отправить сообщение для Markus_13 с помощью ICQ
Talking

блин, все ваши методы лажа, чекбоксы рулят xD
вот наилучшая реализация такой проги: скриншот
Код для FormOnCreate:
Код:
procedure TForm1.FormCreate(Sender: TObject);
var b:byte; c:tCheckBox; e:tEdit; u:tButton; x,y,w,t:word;
begin
font:=screen.MenuFont;
canvas.Font:=font;
x:=8;y:=8;w:=0;
for b:=32 to 255 do begin
c:=tCheckBox.Create(self);c.Parent:=self;
c.Left:=x;c.Top:=y;c.Caption:=chr(b)+#32;
c.Hint:=c.Caption;c.ShowHint:=true;
c.Width:=canvas.TextWidth(c.Caption)+16;
c.Name:='c'+inttostr(b);c.Font:=canvas.Font;c.Show;
c.Checked:=(b>=$C0)or(b=$A8)or(b=$B8);
if b=255 then break;
t:=c.Width+8;
if t>w then w:=t;
inc(y,c.Height+8);
if y>clientHeight-18 then
begin inc(x,w);y:=8;end;
end;
clientWidth:=x+w;
e:=tEdit.Create(self);e.Parent:=self;
e.Left:=8;e.Top:=clientHeight-9;
e.AutoSize:=false;e.Width:=(clientWidth div 3)*2;
e.Name:='ee';e.Text:='test1АБВгде123';e.Show;
clientHeight:=e.Top+e.Height+9;
u:=tbutton.Create(self);u.Parent:=self;
u.Left:=e.Left*2+e.Width;u.Top:=e.Top;
u.Height:=e.Height;u.Width:=clientWidth-u.Left-9;
u.Caption:='Remove selected chars';
u.OnClick:=ButtonClick;
end;
Код для ButtonClick:
Код:
procedure TForm1.ButtonClick(Sender: TObject);
var k:word; b:byte; s:string;
begin
s:=tEdit(FindComponent('ee')).Text;
if length(s)=0 then exit;
for k:=1 to length(s)do begin
b:=ord(s[k]);if b<32 then b:=1 else
if tCheckBox(FindComponent('c'+inttostr(b))).Checked
then b:=1;s[k]:=chr(b);
end;k:=1;
while k<=length(s)do if s[k]=#1 then delete(s,k,1)else inc(k);
tEdit(FindComponent('ee')).Text:=s;
application.MessageBox('All selected chars removed!','');
end;
не забудьте также прописать FormCaption! это самое главное!!!
 
Ответить с цитированием