![]() |
#1
|
|||
|
|||
![]()
Hi all...
Can anyone point me in the right direction.. I am running a very quick cgi web application.. but require a print out as an rtf.. in a stand alone app I drop the richtext componant on, and it does what it needs, and then prints, like i want it to. in the web app, I have to create it at run time.. so I have Code:
with TRichedit.Create(self) do try Visible := false; lines.loadfromfile('c:\formations\testfile.rtf'); // Print('Printer'); finally Free; end; Code:
Internal Application Error Control '' has no parent window so I added Code:
parent := self; and tried parent := nil; even tried parent := application.webform; can anyopne give me that special line I need! Cheers all Aber |
#2
|
|||
|
|||
![]()
I have moved to some of the other code else where, but I have to come back to this one.. any one got any ideas?
its basicly creating a visual comonant on a non visual form I think.. as there isn't a parent window? |
#3
|
|||
|
|||
![]()
Create it something like this:
Code:
var RichEdit1: TRichEdit; begin RichEdit1 := TRichEdit.Create(Self); with RichEdit1 do begin Name := 'RichEdit1'; Parent := Self; Left := 208; Top := 224; Width := 185; Height := 89; Lines.Clear; Lines.Add('RichEdit1'); TabOrder := 0; end; end;
__________________
"Where there's a will, there's always a way." -- The Hon Robert Nester Marley O.M. - aka Bob Marley! |
#4
|
|||
|
|||
![]()
Thanks for the reply.. Thats one of the versiuons I already tried..
Although, I killed the function, and built it again, setting all the properties you sugest, but get the original issue using "self" [DCC Error] codebase.pas(299): E2010 Incompatible types: 'TWinControl' and 'TWebModule1' I am doing it from within a webmodule, and that seems to be my issue.. Any thoughts? |
#5
|
|||
|
|||
![]()
OK - never actually used a TWebModule in Delphi before as never had the need.
I tried the code from a WebModule and yes it does give the Incompatible Types message but if you change the Parent := Self to Nil then it should be ok, and actually compiled fine for me. I see though that you say you have tried using nil as the parent? What Error message/s did you receive?
__________________
"Where there's a will, there's always a way." -- The Hon Robert Nester Marley O.M. - aka Bob Marley! |
#6
|
|||
|
|||
![]()
As you say, compiles, but when you then create the componant, without a parent, you get a runtime error of
Code:
Internal Application Error Control '' has no parent window |
#7
|
|||
|
|||
![]()
You don't really need a richedit to print an rtf file. Please see:
http://www.swissdelphicenter.ch/en/showcode.php?id=1466
__________________
Regards, Abdulaziz Jasser |
#8
|
|||
|
|||
![]()
I see the method, but I am constructing some of the main parts of the rtf from within the code too.. if i understand this code, its printing the rtf, externaly to the code, so much harder to alter the file, and to print it..
but definatly a good fall back, if i can't crack this componant issue... |
#9
|
|||
|
|||
![]()
You can manipulate the file using TStringlist and then save it back and then print it.
Code:
var oSL : TStringlist; begin oSL := TStringlist.Create; oSL.LoadFromFile('C:\Thefile.rtf'); //Do anything here with the file. oSL.SaveToFile('C:\Thefile.rtf');//To the same file or any new file. oSL.Free; //Then here try to print it.
__________________
Regards, Abdulaziz Jasser |
#10
|
|||
|
|||
![]()
I hear what you are saying, and again as a fall back.. but if a few people are doing the tarnsaction at a time, I now need to manage multiple text files on the disk, where creating the rtf dynamicly, means its all managed within the web modual..
this route is more complex to print, uses files so have to manage names etc.. That all said, its getting too close to having to go another route, as this creating an rtf on the fly is turning out to be a mare - no one can help.. |
![]() |
Tags |
create, dynamic, richtext, runtime, twebmodule |
Thread Tools | |
Display Modes | |
|
|