Recent

Author Topic: How can 'Canvas does not allow drawing' be possible ?  (Read 123 times)

J-G

  • Hero Member
  • *****
  • Posts: 1094
How can 'Canvas does not allow drawing' be possible ?
« on: June 09, 2026, 02:57:28 pm »
For many years I've used a routine to determine the height & width of text being sent to a printer such as :
Code: Pascal  [Select][+][-]
  1.   with Printer.Canvas do
  2.     begin
  3.        prLineHeight := trunc(TextHeight('I'));
  4.     end;
  5.  

with no problem and yet with a new program (which compiles) at run time I'm now getting the error cited,

Can anyone suggest why - and point to a solution?
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

cdbc

  • Hero Member
  • *****
  • Posts: 2856
    • http://www.cdbc.dk
Re: How can 'Canvas does not allow drawing' be possible ?
« Reply #1 on: June 09, 2026, 02:58:40 pm »
Hi
Have you forgotten 'BeginDoc' & 'EndDoc' ?!?
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

J-G

  • Hero Member
  • *****
  • Posts: 1094
Re: How can 'Canvas does not allow drawing' be possible ?
« Reply #2 on: June 09, 2026, 03:05:01 pm »
D'Oh!

Actually   no  BUT  -  I am making the call to initialize some aspects PRIOR to the call to BeginDoc   :-[

Thanks Benny
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

 

TinyPortal © 2005-2018