[Gambas-user] Sig #11 when DrawingArea.Width is increased
Eilert
eilert-sprachen at ...221...
Wed Nov 22 12:43:50 CET 2006
timothy schrieb:
>> -----Original Message-----
>> From: gambas-user-bounces at lists.sourceforge.net [mailto:gambas-user-
>> bounces at lists.sourceforge.net] On Behalf Of Eilert
>> Sent: 21 November 2006 09:10
>> To: mailing list for gambas users
>> Subject: [Gambas-user] Sig #11 when DrawingArea.Width is increased
>>
>> Good morning everyone!
>>
>> This is happening in the current 1.0 version.
>>
>> Here is a piece of code from my current project, "Seite" is a
>> DrawingArea where I'm writing text on:
>>
>> draw.Begin(Seite)
>>
>> x = 10 + draw.TextWidth(String.Left(txt[cZ], cS - 1)) - 1
>> y = ((zl - 1) * zh) + 1
>>
>> IF Seite.Width < draw.TextWidth(txt[zl]) + 10 THEN
>> Seite.Width = 10 + draw.TextWidth(txt[zl])
>> END IF
>>
>>
>> When it comes to the case that the TextWidth is greater than the
>> DrawingArea and it tries to increase it, I get a Sig #11 saying
>>
>> QPaintDevice: Cannot destroy paint device that is being painted
>>
>> I looked if I might have nested several Draw.Begin()s, but this isn't
>> the case here. (It happens at another part and runs through flawlessly
>> there.)
>>
>> So thank you for all your comments.
>>
>> Rolf
>>
>
> You can not change the size of a drawing object once you have started
> drawing to it with the Draw.Begin(...) method. You will have to stop
> drawing to change the size of the object.
>
> Draw.Begin(Seite)
> x = 10 + draw.TextWidth(String.Left(txt[cZ], cS - 1)) - 1
> y = ((zl - 1) * zh) + 1
>
> IF Seite.Width < draw.TextWidth(txt[zl]) + 10 THEN
> newWidth = draw.TextWidth(txt[zl])
> Draw.End
> Seite.Width = 10 + newWidth
> Draw.Begin(Seite)
> END IF
>
> Though you could try and re-order things to make it look a lot less ugly
> than this!
>
> Thanks
>
> 8-{)} Timothy Marshal-Nichols
Thanks, Timothy,
this was it :-) I don't know a better way to re-order it either, just
another indent:
> IF Seite.Width < draw.TextWidth(txt[zl]) + 10 THEN
> newWidth = draw.TextWidth(txt[zl])
> Draw.End
> Seite.Width = 10 + newWidth
> Draw.Begin(Seite)
> END IF
Anyway, it runs as expected now.
Regards
Rolf
More information about the User
mailing list