View Issue Details

IDProjectCategoryView StatusLast Update
0027862LazarusWidgetsetpublic2017-10-13 19:53
ReportertheozhAssigned ToMichl 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformLazarus 1.24OSWin 7 64bitOS Version
Product VersionProduct Build 
Target Version1.8Fixed in Version1.8 
Summary0027862: Z-order problem with TSpinEdit
DescriptionIt seems that you cannot place a TSpinEdit/TFloatSpinEdit object on top of a TAChart.
If you change z-order you might see it in edit mode, but if you compile your project it will be hidden below the TAChart.

You can place TEdit, TLabeledEdit, TButton,.... on top but obviously no TSpinEdits.
Steps To Reproduce1) Create a TAChart
2) Create and place a TButton and a TSpinEdit on top of the TAChart.
4) Compile your project.
TButton is still there, TSpinEdit is gone...
TagsNo tags attached.
Fixed in Revisionr54627, r54656, r54657
LazTarget-
WidgetsetWin32/Win64
Attached Files
  • spin-regression.png (2,592 bytes)
    spin-regression.png (2,592 bytes)
  • win32wsspin.pp.patch (590 bytes)
    Index: lcl/interfaces/win32/win32wsspin.pp
    ===================================================================
    --- lcl/interfaces/win32/win32wsspin.pp	(revision 54651)
    +++ lcl/interfaces/win32/win32wsspin.pp	(working copy)
    @@ -337,7 +337,7 @@
         AClientRect.Bottom := Height - BorderWidth * 2;
       end;
       SetWindowPos(UpDown, HWND_TOP,
    -    AClientRect.Right - UpDownWidth, AClientRect.Top, UpDownWidth, AClientRect.Bottom,
    +    AClientRect.Right - UpDownWidth+1, AClientRect.Top-1, UpDownWidth, AClientRect.Bottom+2,
         SWP_NOACTIVATE or SWP_NOZORDER);
     
       SuppressMove := True;
    
    win32wsspin.pp.patch (590 bytes)
  • SpinEditTest.zip (2,010 bytes)

Activities

wp

2015-04-15 15:29

developer   ~0082930

Last edited: 2015-04-15 15:47

View 2 revisions

Is is true that this is related to fpgui? I see the same effect with LCL win, but I do not see it on Linux qt/gtk2.

And it is not related to TAChart, but to most (all?) other components:
- Create a new form
- Add a TButton, a TEdit, a TListbox, a TPanel and some other standard components.
- Drag the last component across the form. Notice that it is on top of all other components. That's what is expected because it is was the lasts component added.
- Now add a TFloatSpinEdit or a TSpinEdit. Drag is around. Notice that it goes *BELOW* all other components. This is not expected.

There seems to be a Z order issue with TFloatSpinEdit/TSpinEdit.

I agree with the OP that this issue is particularly annoying with TAChart because sometimes users want to add input controls on top of the chart, e.g. to modify axis limits. This issue prevents using the TFloatSpinEdit for this purpose.

wp

2015-04-16 10:38

developer   ~0082953

Could somebody please reassign this issue to "LCL" instead of "fpgui"?

Martok

2017-04-15 17:20

reporter   ~0099614

This bug still exists in LCL 1.9.

TFloatSpinEdit/TSpinEdit also ignores runtime calls to BringToFront.

Bart Broersma

2017-04-15 17:28

developer   ~0099615

As a workaround you can use T(Float)SpinEditEx (Tab: LazControls).

Bart Broersma

2017-04-15 17:35

developer   ~0099616

I cannot reproduce this unde Linux GTK2/QT, so probably a widgetset problem.

wp

2017-04-15 17:51

developer   ~0099617

It seems to be Windows widgetset issue because the SpinEdit in qt and gtk2 respects z order.

Bart Broersma

2017-04-17 18:43

developer   ~0099647

On win32 when I do SpinEdit1.BringToFront, it will come in front of the control it was (partially) behind, but the control will loose it's spinbuttons.
SendToBack will send it behinde the other controls again, and restore the spinbuttons.
The same can be seen inside the IDE.

Michl

2017-04-17 22:57

developer   ~0099651

The TSpinEdit was created as the most examples, I found in the net. But the idea to have two windows (Edit and Updown) with the same parent window isn't the best choice. IMHO it is better to have a Edit and a child Updown in it (how it is painted). So the z order neededn't be touched later.

I changed it in Trunk revision 54627. Only tested on Windows 7 (my development pc is gone). Hope it works on other Win32 systems too.

Please test and close if ok.

Ondrej Pokorny

2017-04-20 16:19

reporter   ~0099702

Last edited: 2017-04-20 16:22

View 3 revisions

Michl, your commit broke at least 2 things:
1.) Key Up/Down doesn't increase/decrease the value.
+ Mouse wheel doesn't increase/decrease the value either.
2.) The arrows are misplaced. See spin-regression.png

Ondrej Pokorny

2017-04-20 16:19

reporter  

spin-regression.png (2,592 bytes)
spin-regression.png (2,592 bytes)

Ondrej Pokorny

2017-04-20 16:48

reporter  

win32wsspin.pp.patch (590 bytes)
Index: lcl/interfaces/win32/win32wsspin.pp
===================================================================
--- lcl/interfaces/win32/win32wsspin.pp	(revision 54651)
+++ lcl/interfaces/win32/win32wsspin.pp	(working copy)
@@ -337,7 +337,7 @@
     AClientRect.Bottom := Height - BorderWidth * 2;
   end;
   SetWindowPos(UpDown, HWND_TOP,
-    AClientRect.Right - UpDownWidth, AClientRect.Top, UpDownWidth, AClientRect.Bottom,
+    AClientRect.Right - UpDownWidth+1, AClientRect.Top-1, UpDownWidth, AClientRect.Bottom+2,
     SWP_NOACTIVATE or SWP_NOZORDER);
 
   SuppressMove := True;
win32wsspin.pp.patch (590 bytes)

Ondrej Pokorny

2017-04-20 16:50

reporter   ~0099705

win32wsspin.pp.patch fixes (2). But please first test it on Windows 7 with and without themes (I didn't test without themes).

I assume (1) can be solved in WS code as well with a custom windowproc.

Michl

2017-04-20 21:01

developer   ~0099718

Thank you for testing!

> 1.) Key Up/Down doesn't increase/decrease the value.
> + Mouse wheel doesn't increase/decrease the value either.

Yes, I commented falsely a line, if I enable it, everthing work as expected.


> win32wsspin.pp.patch fixes (2).

Yes, it works an Win 7 too, but the border isn't painted correct. I'll see, if there is a other possibility.

Michl

2017-04-20 22:32

developer   ~0099719

Last edited: 2017-04-20 22:33

View 2 revisions

I reverted the using of client window (revision 54656). I changed the setting of the windows. Now UpDown is positioned before Edit. Then Edit is positioned before UpDown. So Z-order isn't lost.

It works here on Windows 7, also on Win 10?

Ondrej Pokorny

2017-04-20 23:15

reporter  

SpinEditTest.zip (2,010 bytes)

wp

2017-04-20 23:29

developer   ~0099720

Works fine on Win 10

Ondrej Pokorny

2017-04-20 23:36

reporter   ~0099722

Now the Z-order doesn't work again :) See SpinEditTest.zip.

IMO your approach (set parent to the edit and not edit parent) was the only possibility to fix the z-order problems.

We just have to fix the appearance issues - I assume you may position the spin theme-dependently (no themes vs themes enabled).

Ondrej Pokorny

2017-04-21 09:21

reporter   ~0099726

> IMO your approach (set parent to the edit and not edit parent) was the only possibility to fix the z-order problems.

Actually if you achieve that the z-order is recreated after BringToFront and SendToBack (in the same way as you do it in AdaptBounds) then it will work as well.

Michl

2017-04-21 11:11

developer   ~0099727

@Ondrej:

Thank you for the test example! I only checked the issue described in the bugreport. I've not tested BringToFront and SendToBack.

I fixed the issue, as you told me in #c99726 in Trunk revision 54657. Please try and report, if there is a problem left.

Ondrej Pokorny

2017-04-21 13:55

reporter   ~0099729

Excellent work, Michl! No problems left, as far as I can see.

Michl

2017-04-21 20:00

developer   ~0099739

Thank you for testing! So I close this issue.

@theozh: Please test and close if ok.

Bart Broersma

2017-04-21 22:54

developer   ~0099750

Merge to 1.8 fixes branch?

Michl

2017-04-21 23:22

developer   ~0099752

I think there isn't anything broken, so yes I've merged it now (Laz 1.8RC1 revision 54673).

Martok

2017-04-22 00:32

reporter   ~0099753

My usecase from last week looks good now, with and without themes on Win8.1. Thanks!

Issue History

Date Modified Username Field Change
2015-04-15 12:40 theozh New Issue
2015-04-15 15:29 wp Note Added: 0082930
2015-04-15 15:47 wp Note Edited: 0082930 View Revisions
2015-04-16 10:38 wp Note Added: 0082953
2015-04-24 14:37 Graeme Geldenhuys Project fpGUI => Lazarus
2015-04-25 10:29 Zeljan Rikalo LazTarget => -
2015-04-25 10:29 Zeljan Rikalo Category Widgetset => LCL
2017-04-15 17:20 Martok Note Added: 0099614
2017-04-15 17:28 Bart Broersma Note Added: 0099615
2017-04-15 17:35 Bart Broersma Note Added: 0099616
2017-04-15 17:35 Bart Broersma Category LCL => Widgetset
2017-04-15 17:36 Bart Broersma Summary z-order with TAChart and TSpinEdit => Z-order problem with TSpinEdit
2017-04-15 17:51 wp Note Added: 0099617
2017-04-15 21:51 Juha Manninen Widgetset => Win32/Win64
2017-04-17 18:43 Bart Broersma Note Added: 0099647
2017-04-17 22:14 Michl Assigned To => Michl
2017-04-17 22:14 Michl Status new => assigned
2017-04-17 22:57 Michl Fixed in Revision => r54627
2017-04-17 22:57 Michl Note Added: 0099651
2017-04-17 22:57 Michl Status assigned => resolved
2017-04-17 22:57 Michl Fixed in Version => 1.7 (SVN)
2017-04-17 22:57 Michl Resolution open => fixed
2017-04-20 16:19 Ondrej Pokorny Note Added: 0099702
2017-04-20 16:19 Ondrej Pokorny Status resolved => assigned
2017-04-20 16:19 Ondrej Pokorny Resolution fixed => reopened
2017-04-20 16:19 Ondrej Pokorny File Added: spin-regression.png
2017-04-20 16:20 Ondrej Pokorny Note Edited: 0099702 View Revisions
2017-04-20 16:22 Ondrej Pokorny Note Edited: 0099702 View Revisions
2017-04-20 16:48 Ondrej Pokorny File Added: win32wsspin.pp.patch
2017-04-20 16:50 Ondrej Pokorny Note Added: 0099705
2017-04-20 21:01 Michl Note Added: 0099718
2017-04-20 22:32 Michl Note Added: 0099719
2017-04-20 22:32 Michl Status assigned => feedback
2017-04-20 22:33 Michl Note Edited: 0099719 View Revisions
2017-04-20 23:15 Ondrej Pokorny File Added: SpinEditTest.zip
2017-04-20 23:29 wp Note Added: 0099720
2017-04-20 23:36 Ondrej Pokorny Note Added: 0099722
2017-04-21 09:21 Ondrej Pokorny Note Added: 0099726
2017-04-21 11:11 Michl Note Added: 0099727
2017-04-21 11:12 Michl Fixed in Revision r54627 => r54627, r54656, r54657
2017-04-21 13:55 Ondrej Pokorny Note Added: 0099729
2017-04-21 20:00 Michl Note Added: 0099739
2017-04-21 20:00 Michl Status feedback => resolved
2017-04-21 20:00 Michl Resolution reopened => fixed
2017-04-21 22:54 Bart Broersma Note Added: 0099750
2017-04-21 23:22 Michl Note Added: 0099752
2017-04-21 23:23 Michl Fixed in Version 1.7 (SVN) => 1.8
2017-04-21 23:23 Michl Target Version => 1.8
2017-04-22 00:32 Martok Note Added: 0099753