Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > Pageproducer in delphi
User Name
Password
REGISTER NOW! Mark Forums Read




Reply
1 1st November 12:12
brian
External User
 
Posts: 1
Default Pageproducer in delphi



Hi All

I have been looking round the net trying to get some help and can't find
any,
so either this is very simple and I can't see it or so hard that nobody uses
Pageproducer in Delphi.

below is some code I have been using, what I don't understand it when I call
the Page Producer from the UpdateMsgs function when it runs the OnHTMLTag
it should just run the loop 7 times, but it does it a lot more, have I
missed the point
here in how to use Page Producer ?


function UpdateMsgs():boolean;
var txtFile : TextFile;
Str : string;
begin
// get and show new txt
MainForm.MSGProducer.HTMLFile:=AppDir+'msgs.html';
Str := MainForm.MSGProducer.Content;
AssignFile(txtFile,AppDir+'op.html');
Rewrite(txtFile);
writeln(txtFile,Str);
CloseFile(txtFile);
MainForm.WebBrowser1.Navigate(WideString(AppDir+'o p.html));
MainForm.WebBrowser1.Refresh;
end;

procedure TMainForm.MSGProducerHTMLTag(Sender: TObject; Tag: TTag;
const TagString: String; TagParams: TStrings; var ReplaceText: String);
var InMsg : string;
i : integer;
begin
for i:=1 to 7 do
begin
if TxtMessages[i].Gender <> '' then
begin
if TxtMessages[i].Gender = 'Male' then
begin
if TagString = 'gender'+IntToStr(i) then ReplaceText:= '<img
src="'+EmotionImgPath+'male.gif">';
end else begin
if TagString = 'gender'+IntToStr(i) then ReplaceText:= '<img
src="'+EmotionImgPath+'female.gif">';
end;
end;

if TxtMessages[i].User = 'DJ' then
begin
if TagString = 'gender'+IntToStr(i) then ReplaceText:= '<img
src="'+EmotionImgPath+'dj.gif">';
end;
if TxtMessages[i].User = '' then InMsg:=TxtMessages[i].Msg else InMsg:=
'<font face="Courier New, Courier,
mono"><em>'+TxtMessages[i].User+'</em></font>: '+ TxtMessages[i].Msg;
InMsg:=AddEmotions(InMsg);
if TagString = 'msg'+IntToStr(i) then ReplaceText:= InMsg;
end;

// text colour
if TagString = 'colour' then ReplaceText:= TextColour;
// background
if TagString = 'background' then ReplaceText:=
TXTBackGroundImgPath+BackGround;

end;
  Reply With Quote


 


Reply


Thread Tools
Display Modes




666