'canvas does not allow drawing'

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
pdpearce
Posts: 13
Joined: Thu Feb 03, 2005 11:56 am
Location: Bakewell UK

'canvas does not allow drawing'

Post by pdpearce »

I have just upgraded TsiLang from 5.3.2 to 6.0 in Delphi 5.

All of my previously written applications give a 'canvas does not allow drawing' error message upon compilation.

In a new blank application, dropping a siLangCombo onto the form gives the same error.

:(

Any help would be appreciated.
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Open siLangCombo unit and replace TsiLangCombo.MeasureItem() with the following code (as temporary fix):

Code: Select all

procedure TsiLangCombo.MeasureItem(Index: Integer; var Height: Integer);
begin
  inherited;
end;
We will investigate the case (this wrong behavior only under Delphi 4 and 5) and will implement the permanent fix.

Thank you for information!
Best regards,
Igor Siticov.
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

The following modifications needed:

Code: Select all

procedure TsiLangCombo.MeasureItem(Index: Integer; var Height: Integer);
var
{$IFNDEF DELPHI6}
   CC: TControlCanvas;
{$ENDIF}   
   I: Integer;
begin
  if Assigned(OnMeasureItem) then      
    OnMeasureItem(Self, Index, Height)
  else
  begin
{$IFNDEF DELPHI6}
    I := Height;
    CC := TControlCanvas.Create;
    try
      CC.Control := Self;
      if CC.Handle <> 0 then
        I := CC.TextHeight('H') + 3;
    finally
      CC.Free;
    end;
{$ELSE}
    I := Canvas.TextHeight('H') + 3;
{$ENDIF}
    if I > Height then
      Height := I;
  end;
end;
We will re-create builds on web site asap. Thank you for reporting!
Best regards,
Igor Siticov.
pdpearce
Posts: 13
Joined: Thu Feb 03, 2005 11:56 am
Location: Bakewell UK

Post by pdpearce »

Excellent work ! :D

Best Regards
Philip
pdpearce
Posts: 13
Joined: Thu Feb 03, 2005 11:56 am
Location: Bakewell UK

Post by pdpearce »

Still having trouble with the siLangCombo component in Delphi 5.
:?
In design mode, double-clicking used to give the property editor, but now gives the 'canvas does not allow drawing' error.
The error eventually disappears after repeated clicking of the OK button and then gives the property editor.

I have repeated this behaviour occur using a blank form containing only a siLangDispatcher component and a siLangCombo component.

Any help would be appreciated.
Haron
Posts: 39
Joined: Thu Mar 11, 2004 6:29 am

Post by Haron »

Please use temporary workaround: former TComboBox instead of TsiLangCombo before support come back in a week. At least you will be able to switch language in run-time :)
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Please re-download build from our site (updated at June 20) and let us know if this fixes the problem. Thank you.
Best regards,
Igor Siticov.
pdpearce
Posts: 13
Joined: Thu Feb 03, 2005 11:56 am
Location: Bakewell UK

Post by pdpearce »

I have now downloaded the updated version.
Still gives the same effect:
On double-clicking the siComboBox during design-time, it gives the 'canvas does not allow drawing' error. After clicking the ok button of the error message a number of times, the language settings box finally appears.

Regards
Philip
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Fixing this now...
Best regards,
Igor Siticov.
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Updated builds will be available for download during next days. Meantime you can fix this manually on your side:
1. Open _siComboPropEd.pas unit
2. Modify procedure TfrmSiLangComboEditor.cbFlagsMeasureItem as following:

Code: Select all

procedure TfrmSiLangComboEditor.cbFlagsMeasureItem(Control: TWinControl;
  Index: Integer; var Height: Integer);
begin
  try
    Height := cbFlags.Canvas.TextHeight('H') + 4;
  except
  end;
end;
3. Re-build TsiLang package.

Sorry for any inconvenience.
Best regards,
Igor Siticov.
Post Reply