Awkwardsaw
2009-09-18 07:38:57
i was bored, and i figured this would keep me some-what busy(using it, lol)
so, here i am presenting you 2-min of work, for you to laugh at, and hopefully be entertained :)
also, i would like a better way to get the text off of the page, since there is a lot of un-nessesary spaces for the chuck and mr t facts
so, here i am presenting you 2-min of work, for you to laugh at, and hopefully be entertained :)
also, i would like a better way to get the text off of the page, since there is a lot of un-nessesary spaces for the chuck and mr t facts
program New;
var
// Initform variables.
frmDesign : TForm;
GroupBox1 : TGroupBox;
RadioButton1, RadioButton2, RadioButton3 : TRadioButton;
Memo1 : TMemo;
Button1 : TButton;
// This form was parsed using DFM Form Parser v.26c Beta by Ron.
// Generated from FactGenerator.dfm.
function GetFact(site, s1, s2: string): string;
var a: string;
begin
a:= getpage(site);
result:= TrimEx(' ', between(s1, s2, a));
end;
procedure StartClick(sender: TObject);
begin
if RadioButton1.Checked then
Memo1.Text:= GetFact('http://4q.cc/index.php?pid=fact&person=chuck', '<div id="factbox">', '</div>');
if RadioButton2.Checked then
Memo1.Text:= GetFact('http://4q.cc/index.php?pid=fact&person=mrt', '<div id="factbox">', '</div>');
if RadioButton3.Checked then
Memo1.Text:= GetFact('http://www.randomfunfacts.com/',
'<td bordercolor="#FFFFFF"><font face="Verdana" size="4"><strong><i>', '</i></strong></font>');
end;
procedure Initform;
var
TimeInitform : Integer;
begin
TimeInitform := GetSystemTime;
frmDesign := CreateForm;
with frmDesign do
begin
Position := poScreenCenter;
BorderStyle := bsSingle;
BorderIcons := [biMinimize,biSystemMenu];
Width := 365;
Height := 183;
Caption := 'Akwardsaw'#39's Fact Generator';
Color := clBtnFace;
Font.Color := clWindowText;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
PixelsPerInch := 96;
end;
GroupBox1 := TGroupBox.Create(frmDesign);
with GroupBox1 do
begin
Parent := frmDesign;
Left := 8;
Top := 8;
Width := 97;
Height := 89;
Caption := 'What Fact?';
TabOrder := 0;
end;
RadioButton1 := TRadioButton.Create(GroupBox1);
with RadioButton1 do
begin
Parent := GroupBox1;
Left := 8;
Top := 16;
Width := 113;
Height := 17;
Caption := 'Chuck Norris';
TabOrder := 0;
end;
RadioButton2 := TRadioButton.Create(GroupBox1);
with RadioButton2 do
begin
Parent := GroupBox1;
Left := 8;
Top := 40;
Width := 113;
Height := 17;
Caption := 'Mr. T';
TabOrder := 1;
end;
RadioButton3 := TRadioButton.Create(GroupBox1);
with RadioButton3 do
begin
Parent := GroupBox1;
Left := 8;
Top := 64;
Width := 113;
Height := 17;
Caption := 'Random';
TabOrder := 2;
end;
Memo1 := TMemo.Create(frmDesign);
with Memo1 do
begin
Parent := frmDesign;
Left := 112;
Top := 16;
Width := 225;
Height := 81;
with Lines do
begin
Add('');
end;
TabOrder := 9;
ScrollBars := ssVertical;
end;
Button1 := TButton.Create(frmDesign);
with Button1 do
begin
Parent := frmDesign;
Left := 96;
Top := 112;
Width := 73;
Height := 25;
Caption := 'Generate';
TabOrder := 10;
Button1.OnClick := @StartClick;
end;
WriteLn('Initform compiled in ' + IntToStr(GetSystemTime - TimeInitform) + ' milliseconds!');
end;
procedure SafeInitform;
var
v : TVariantArray;
begin
SetArrayLength(v, 0);
ThreadSafeCall('Initform', v);
end;
procedure ShowInitformModal;
begin
frmDesign.ShowModal;
end;
procedure SafeShowInitformModal;
var
v : TVariantArray;
begin
SetArrayLength(v, 0);
ThreadSafeCall('ShowInitformModal', v);
end;
procedure MainInitform;
begin
try
SafeInitform;
SafeShowInitformModal;
finally
FreeForm(frmDesign);
except
WriteLn('An error seems to have occurred in: Initform');
end;
end;
begin
ClearDebug;
MainInitform;
end.