Page 1 of 1

'canvas does not allow drawing'

Posted: Fri Jun 17, 2005 8:23 am
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.

Posted: Fri Jun 17, 2005 9:41 am
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!

Posted: Fri Jun 17, 2005 1:56 pm
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!

Posted: Fri Jun 17, 2005 3:10 pm
by pdpearce
Excellent work ! :D

Best Regards
Philip

Posted: Tue Jul 05, 2005 11:17 am
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.

Posted: Thu Jul 07, 2005 10:59 am
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 :)

Posted: Mon Jul 11, 2005 4:22 am
by isiticov
Please re-download build from our site (updated at June 20) and let us know if this fixes the problem. Thank you.

Posted: Mon Jul 11, 2005 9:37 am
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

Posted: Mon Jul 11, 2005 11:14 am
by isiticov
Fixing this now...

Posted: Tue Jul 12, 2005 3:01 pm
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.