[Gambas-user] Paint misbehaves on QT when a ValueBox.value is changed (v3.5.4)

T Lee Davidson t.lee.davidson at ...626...
Fri Oct 10 18:13:33 CEST 2014


On 10/09/2014 07:32 PM, Benoît Minisini wrote:
> Le 10/10/2014 00:04, T Lee Davidson a écrit :
>> If a form's ValueBox.value is modified, subsequent Paint'ing on a cached
>> DrawingArea of the form doesn't produce the draw when the gb.qt4
>> component is loaded. It does work if, instead, the gb.gtk component is
>> manually selected in the project. Trying to set the focus back to the
>> DrawingArea, "DrawingArea1.SetFocus", after modifying the ValueBox.value
>> did not help.
>>
>> I have attached an archive of a sample project that shows this.
>>
>> Also, the sample project contains two methods to clear the DrawingArea,
>> because what works for GTK does not work for QT.
>>
>> Is this a bug, or am I doing something wrong?
>>
>>
>> Thanks for any help,
>> Lee
>>
>>
>
> I saw no problem in the drawing, whatever the GUI component (gb.qt4,
> gb.gtk or gb.gtk3). But I saw that there are bugs in DrawingArea.Clear()
> in all components!
>
> Regards,
>

I have found that, on my system, modifying the value of a TextBox also 
causes this behavior. However...

If I use DrawingArea1.Show after modifying a text or value box, the 
drawing does indeed show correctly after the method terminates and 
returns control to the main loop (even though it does not appear to be 
drawing correctly during the procedure itself).

[code]
Public Sub btnDraw_Click()

   'Line 1
   Paint.Begin(DrawingArea1)
   Paint.Brush = Paint.Color(Color.RGB(255, 0, 0))
   Paint.LineWidth = 5
   Paint.MoveTo(10, DrawingArea1.Height / 3)
   Paint.LineTo(DrawingArea1.Width - 10, DrawingArea1.Height / 3)
   Paint.Stroke
   Paint.End
   Debug "Drew red line. Sleeping 2."
   Sleep 2

   ValueBox1.Value = Int(Rnd(100, 999))
   '***
   ' The line below makes the drawing show correctly after this
   ' method returns control to main loop.
   '***
   DrawingArea1.Show

   'Line 2
   Paint.Begin(DrawingArea1)
   Paint.Brush = Paint.Color(Color.RGB(0, 0, 255))
   Paint.LineWidth = 5
   Paint.MoveTo(10, DrawingArea1.Height / 3 * 2)
   Paint.LineTo(DrawingArea1.Width - 10, DrawingArea1.Height / 3 * 2)
   Paint.Stroke
   Paint.End
   Debug "Drew blue line. Sleeping 2."
   Sleep 2

End
[/code]




More information about the User mailing list