Now, write the codes for each event of the components :
When the first time we run the program, we set the default values of some component's properties. So we write some codes on FormActivate event of Form1 :
procedure TForm1.FormActivate(Sender: TObject);
begin
Memo1.Text := '';
Memo2.Text := '';
Memo2.SetFocus;
Edit1.Enabled := false;
Edit2.Enabled := false;
Edit3.Enabled := false;
RadioButton1.Checked := true;
RadioButton2.Checked := false;
RadioGroup1.ItemIndex := 0;
Edit4.Text := '1';
Edit5.Text := '1';
end;
The codes for RadioButtons ( Text Only and Link Codes ) :
procedure TForm1.RadioButton1Click(Sender: TObject);
begin
Edit1.Enabled := false;
Edit2.Enabled := false;
Edit3.Enabled := false;
Memo2.Enabled := true;
Memo2.SetFocus;
end;
procedure TForm1.RadioButton2Click(Sender: TObject);
begin
Edit1.Enabled := true;
Edit2.Enabled := true;
Edit3.Enabled := true;
Memo2.Enabled := false;
Edit1.SetFocus;
end;
We need to limit the input of rows and columns for numeric inputs only :
procedure TForm1.Edit4KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['0'..'9', #8]) then key := #0;
end;
procedure TForm1.Edit5KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['0'..'9', #8]) then key := #0;
end;
And the other codes for the events of the rest components are :
procedure TForm1.GenerateButtonClick(Sender: TObject);
var
LinkBanner : string;
begin
if RadioButton1.Checked then
begin
memo1.Text :='<p align="'+RadioGroup1.Items.String
[RadioGroup1.ItemIndex]+'"><textarea name="code" rows="' +
Edit4.Text + '" cols="' +Edit5.Text + '">' + memo2.Text +
'</textarea></p>';
end else
begin
LinkBanner := '<a href="' + Edit2.Text +
'"target="_blank"><img src="'+Edit1.Text +
'" border="0" alt="' + Edit3.Text + '" /></a>';
memo1.Text := RadioGroup1.Items.Strings[RadioGroup1.ItemIndex] +
'"><textarea name="code" rows="' +
Edit4.Text + '" cols="'+Edit5.Text + '">' + LinkBanner +
'</textarea></p>';
end;
end;
procedure TForm1.ClearButtonClick(Sender: TObject);
memo1.Text := '';
end;
procedure TForm1.ExitButtonClick(Sender: TObject);
begin
Application.Terminate;
end;
To see the complete codes you can download this project here.
mungkin ini yang digunakan untuk menampilkan kode script dalam postingan
ReplyDeletesemoga sukses selalu kawan
nanti saya kasih buat temen saya yang jadi asdos delpi :)
ReplyDelete@Pakde : yes, it's true, we can create a text area that contains some HTML codes to be posted.
ReplyDelete@Secangkir.. : thank you.. you can download this project and give to your friend.. :)
wah buat parse kode untuk diposting ini ya ?
ReplyDeletenumpang download ya, siapa tau nanti kepake..
ReplyDeletevery helpfull , thank for share
ReplyDelete@Artikel : yuup, that's right
ReplyDelete@Dimas : Ok, thanks
@big ribbon : you're welcome :)
langsung download ...
ReplyDeletesalam kenal jg sob
jangan lupa mampir lg OK
@imtikham : Ok... thank you !
ReplyDelete