Slider issue

Post

Posted
Rating:
#1 (In Topic #1419)
Avatar
Guru
cogier is in the usergroup ‘Guru’
Hi all,

Can you please confirm that it's not just me, but I have discovered a problem with Gambas 3.20.1 (and maybe 3.20.0), all seems OK on my laptop that has 3.19.5. The following code causes an overflow when the slider reaches about 25%. Does it work for you? (The slider values used are to cover all the colours available).

Code (gambas)

  1. Public Sub Form_Open()
  2.  
  3.   Dim Slider1 As Slider
  4.  
  5.   With Me
  6.     .Arrangement = Arrange.Vertical
  7.     .H = 40
  8.     .W = 1000
  9.     .Padding = 5
  10.  
  11.   With Slider1 = New Slider(Me)
  12.     .H = 28
  13.     .MinValue = 0
  14.     .MaxValue = 16777215
  15.  
  16.  
Online now: No Back to the top

Post

Posted
Rating:
#2
Regular
vuott is in the usergroup ‘Regular’
Yes, I confirm.

Europaeus sum !

<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Online now: No Back to the top

Post

Posted
Rating:
#3
Guru
BruceSteers is in the usergroup ‘Guru’
 Confirmed.

seems to be line 96 of Slider.class (gb.gui.base)

  X = W * ($iValue - $iMinValue) / ($iMaxValue - $iMinValue)

it's okay if the division gets (parenthesis)

like this..
  X = W * (($iValue - $iMinValue) / ($iMaxValue - $iMinValue))

if you compile you can fix it.

i don't think it's the correct fix , just a work around for a deeper issue Benoit will know.
Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Guru
cogier is in the usergroup ‘Guru’
Thanks guys. Now I know it's not just me!
I have submitted a bug report for this issue.

For fun, try adding the line below to the above code, the slider control knob disappears!

Code (gambas)

  1. System.Ignoreoverflow = True
Online now: No Back to the top
1 guest and 0 members have just viewed this.