[gtkada] Testgtk of GtkAda-1.3.12 on Windows 2000

Emmanuel Briot briot at ACT-Europe.FR
Mon Sep 16 16:58:09 CEST 2002


"Anh Vo" <Anh.Vo at udlp.com> writes:

> A Constraint_Error is raised at gtkada-canvas.adb:2758 any time the
> Canvas, under GtkAda Demo tab, is zoomed out. I spotted the problem
> after examining it closely. The culprit code is included below for easy
> discussion.

Strange, this isn't something we haven't seen before, and we use this feature
extensively in GVD and now in GPS.


>          Canvas.Zoom_Step := (Gint (Percent - Canvas.Zoom) / Gint
> (Steps));
> 
> both Percent and Canvas.Zoom are unsigned type GUint. When the canvas
> is zoomed in, the Percent is less than Canvas.Zoom. The subtraction
> operation yield a negative number. It is out of GUint range. Therefore,
> Constraint_Error was raised. The fix that I put in  is shown below.


I do not agree with the diagnostic above: guint is a modular type, so the
result of the substraction will not be negative, it will just be a huge number,
still in range of guint. However, I think your suggested modification is indeed
better and should be integrated.

Since we haven't been able to reproduce this, could you give more information,
for instance the values of Percent and Canvas.Zoom ? (maybe you were trying to
zoom to some level we haven't tried...)


regards,
Emmanuel




More information about the gtkada mailing list