View Issue Details

IDProjectCategoryView StatusLast Update
0025735LazarusLCLpublic2016-02-26 17:07
Reporterbarlone Assigned ToBart Broersma  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionduplicate 
PlatformWin32OSWindows XP SP3 
Product Version1.3 (SVN) 
Target Version1.6 
Summary0025735: Behavior of TSpinEdit.MaxValue differs under Win32 and Gtk2 widgetsets
DescriptionIf MaxValue = 0

Win32: like no constraints, allow all numeric values in Value
Gtk2: only "0" allowed

Tested under Windows (win32 and gtk2) and Linux (gtk2)
TagsNo tags attached.
Fixed in Revision
LazTarget1.6
WidgetsetGTK 2, Win32/Win64
Attached Files

Relationships

duplicate of 0029645 closedBart Broersma Lazarus TFloatSpinEdit on GTK2 does not allow unconstrained min and max values 
related to 0028123 assignedZeljan Rikalo Patches TFloatSpinEdit, TSpinEdit: Cannot enter value as expected 

Activities

Zeljan Rikalo

2014-02-18 13:24

developer   ~0073129

Please attach example.

barlone

2014-02-18 13:53

reporter  

spinedit.zip (128,053 bytes)

barlone

2014-02-18 13:54

reporter   ~0073132

Attached with Gtk and Win32 build profiles

Bart Broersma

2014-02-18 16:31

developer   ~0073136

AFAIK the GTK2 WS does not allow having no constraints.
You'll have to set MaxValue/MinValue to High/Low of type Float (in code, otherwise the form wont load...)

Juha Manninen

2014-02-18 17:02

developer   ~0073138

Bart, the logic can be done in the bindings code. The special treatment for 0 is useful but now it cannot be used in a cross-platform application.

Zeljan Rikalo

2014-02-18 20:36

developer   ~0073144

Ok: Same behaviour as gtk2 is under qt too (no constraints if Min=Max).
Embarcadero doesn't say anything about MinValue = MaxValue and constraints of that properties.
This is behaviour of win32 so if this is an bug then it should be win32 bug only (simply because win32 reset constraints if MinValue = 0 and MaxValue = 0 so you can input any number, and others not).
Now we must decide if we should follow win32 behaviour with all other widgetsets, or fix win32 to be same as others, or leave everything as it is.

Juha Manninen

2014-02-18 20:59

developer   ~0073148

I think this time the Delphi compatible way makes sense because existing code relays on it, and because this behavior or good and intuitive.
Otherwise MinValue = 0 and MaxValue = 0 is useless. Why not make it usefull at the same go?

Bart Broersma

2014-02-18 23:17

developer   ~0073155

Last edited: 2014-02-18 23:31

View 2 revisions

AFAIK on Windows the value is only constrained if MaxValue > MinValue.
(On Delphi weird things happen when MinValue > MaxValue, no need to follow that)

TWin32WSCustomFloatSpinEdit.DefaultWndHandler calls GetLimitedValue which controls the logic behind constraining the value.

Zeljan Rikalo

2014-02-19 08:28

developer   ~0073158

Ok, so what's final decision ? if (MaxValue = 0) and (MaxValue = MinValue) then InternalMinValue = -MAXINT InternalMaxValue = MAXINT (eg. in case of TSpinEdit).
We must handle this in ws bindings, because ws does not support it.

Juha Manninen

2014-02-19 12:53

developer   ~0073162

Zeljan, sounds good to me.

Bart Broersma

2014-02-19 13:26

developer   ~0073164

To be consistent with win32 ws it should be:
if MinValue > MaxValue (so not only when MaxValue = 0)

Zeljan Rikalo

2014-02-19 21:10

developer   ~0073167

so final code to trigger such behaviour should be:
if ((MaxValue = 0) and (MaxValue = MinValue)) or (MinValue > MaxValue) then InternalMinValue = -MAXINT InternalMaxValue = MAXINT (eg. in case of TSpinEdit) .... ? @Bart, what happens if MinValue = 10 and MaxValue = 10 ?

Bart Broersma

2014-02-20 18:52

developer   ~0073179

@Zeljan: My mistake: should be unconstrained when MinValue >= MaxValue.
See GetLimitedValue for the algorithm.

> what happens if MinValue = 10 and MaxValue = 10
Currently on windows the value then is unconstrained.
I cannot check if this is Delphi compatible, my D7 doesn't have SpinEdit...

barlone

2014-02-24 19:20

reporter   ~0073261

I`ve test in D7 situation with MinValue = 10 and MaxValue = 10: TSpinEdit behaves as if there are no restrictions - i can input any values

Bart Broersma

2016-02-20 17:41

developer   ~0090167

Fixed in r51619 (see 0029645).

Issue History

Date Modified Username Field Change
2014-02-18 12:56 barlone New Issue
2014-02-18 13:24 Zeljan Rikalo LazTarget => -
2014-02-18 13:24 Zeljan Rikalo Note Added: 0073129
2014-02-18 13:24 Zeljan Rikalo Assigned To => Zeljan Rikalo
2014-02-18 13:24 Zeljan Rikalo Status new => feedback
2014-02-18 13:53 barlone File Added: spinedit.zip
2014-02-18 13:54 barlone Note Added: 0073132
2014-02-18 13:54 barlone Status feedback => assigned
2014-02-18 16:31 Bart Broersma Note Added: 0073136
2014-02-18 17:02 Juha Manninen Note Added: 0073138
2014-02-18 20:36 Zeljan Rikalo Note Added: 0073144
2014-02-18 20:36 Zeljan Rikalo Status assigned => feedback
2014-02-18 20:59 Juha Manninen Note Added: 0073148
2014-02-18 23:17 Bart Broersma Note Added: 0073155
2014-02-18 23:31 Bart Broersma Note Edited: 0073155 View Revisions
2014-02-19 08:28 Zeljan Rikalo Note Added: 0073158
2014-02-19 12:53 Juha Manninen Note Added: 0073162
2014-02-19 13:26 Bart Broersma Note Added: 0073164
2014-02-19 21:10 Zeljan Rikalo Note Added: 0073167
2014-02-20 18:52 Bart Broersma Note Added: 0073179
2014-02-24 19:20 barlone Note Added: 0073261
2014-02-24 19:20 barlone Status feedback => assigned
2015-06-25 13:58 Zeljan Rikalo Relationship added related to 0028123
2016-02-20 17:39 Bart Broersma Assigned To Zeljan Rikalo => Bart Broersma
2016-02-20 17:41 Bart Broersma LazTarget - => 1.6
2016-02-20 17:41 Bart Broersma Note Added: 0090167
2016-02-20 17:41 Bart Broersma Relationship added duplicate of 0029645
2016-02-20 17:41 Bart Broersma Status assigned => resolved
2016-02-20 17:41 Bart Broersma Resolution open => duplicate
2016-02-20 17:41 Bart Broersma Target Version => 1.6
2016-02-26 17:07 barlone Status resolved => closed