SiComponents Home Page SiComponents Forums
Here you will be able to get help and share your experience
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

'canvas does not allow drawing'

 
Post new topic   Reply to topic    SiComponents Forums Forum Index -> TsiLang Components Suite
View previous topic :: View next topic  
Author Message
pdpearce



Joined: 03 Feb 2005
Posts: 13
Location: Bakewell UK

PostPosted: Fri Jun 17, 2005 8:23 am    Post subject: 'canvas does not allow drawing' Reply with quote

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.

Sad

Any help would be appreciated.
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2095

PostPosted: Fri Jun 17, 2005 9:41 am    Post subject: Reply with quote

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

Code:
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!
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2095

PostPosted: Fri Jun 17, 2005 1:56 pm    Post subject: Reply with quote

The following modifications needed:

Code:
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!
Back to top
View user's profile Send private message
pdpearce



Joined: 03 Feb 2005
Posts: 13
Location: Bakewell UK

PostPosted: Fri Jun 17, 2005 3:10 pm    Post subject: Reply with quote

Excellent work ! Very Happy

Best Regards
Philip
Back to top
View user's profile Send private message
pdpearce



Joined: 03 Feb 2005
Posts: 13
Location: Bakewell UK

PostPosted: Tue Jul 05, 2005 11:17 am    Post subject: Reply with quote

Still having trouble with the siLangCombo component in Delphi 5.
Confused
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.
Back to top
View user's profile Send private message
Haron



Joined: 11 Mar 2004
Posts: 39

PostPosted: Thu Jul 07, 2005 10:59 am    Post subject: Reply with quote

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 :)
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2095

PostPosted: Mon Jul 11, 2005 4:22 am    Post subject: Reply with quote

Please re-download build from our site (updated at June 20) and let us know if this fixes the problem. Thank you.
Back to top
View user's profile Send private message
pdpearce



Joined: 03 Feb 2005
Posts: 13
Location: Bakewell UK

PostPosted: Mon Jul 11, 2005 9:37 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2095

PostPosted: Mon Jul 11, 2005 11:14 am    Post subject: Reply with quote

Fixing this now...
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2095

PostPosted: Tue Jul 12, 2005 3:01 pm    Post subject: Reply with quote

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:
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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    SiComponents Forums Forum Index -> TsiLang Components Suite All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by p h p B B  © 2001, 2005 p h p B B  Group