View Issue Details

IDProjectCategoryView StatusLast Update
0027609LazarusIDEpublic2021-03-12 14:18
ReporterMike Sapsard Assigned ToJuha Manninen  
PriorityhighSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Platformi7 PCOSLinux Mint 
Product Version1.4RC1 
Summary0027609: Setting z-order of objects does not work - regression
Descriptionz-order depends on the order of objects in the .lfm file. The attached example shows two buttons and two comboboxes. The z-order in the lfm file is btn1, cmbox1, cmbox2, btn2.

1) When the form is reduced in width by dragging the right side, the comboboxes and btn2 slide over btn1. They should slide under.

2) Right clicking and changing the z-order also does not move the object begin ... end block in the .lfm file.

Steps To ReproduceRun attached file
Additional InformationThere are several bug reports, patches/fixes for related problems. This may be an accidental regression.
TagsNo tags attached.
Fixed in Revision
LazTarget-
WidgetsetGTK 2, Win32/Win64, WinCE, Carbon, Cocoa, QT
Attached Files

Relationships

related to 0020450 resolvedJuha Manninen Changing z-order of controls from the OI does not update the designer 
related to 0027419 closedBart Broersma Z-order problem on GTK2 
related to 0032010 new No Z-order activity does work 

Activities

Mike Sapsard

2015-03-05 21:41

reporter  

published.zip (3,360 bytes)

Mike Sapsard

2015-03-06 10:18

reporter   ~0081673

Lazarus version is 1.4RC2.

Juha Manninen

2015-03-06 19:46

developer   ~0081685

Is this a regression compared to Lazarus 1.2.x?

Mike Sapsard

2015-03-16 11:58

reporter   ~0082002

I have done some more tests. Editing and changing z-order in Lazarus IDE does not save changes. Closing Lazarus and editing the .lfm file in a text editor changes the order in the Object Inspector. But, even after Clean and Rebuild it only shows changes in the Object Inspector. The z-order when the application is run, does not change.

Zeljan Rikalo

2015-03-16 15:06

developer   ~0082011

IMO, this is important issue and should be fixed by 1.4. It's designer bug, not widgetsets.

Bart Broersma

2015-03-16 18:57

developer   ~0082017

Last edited: 2015-03-16 18:58

View 2 revisions

Lazarus 1.5 r47837 FPC 2.6.4 i386-win32-win32/win64: OK

Lazarus 1.5 r48395 FPC 2.6.4 i386-win32-win32/win64:
- in IDE changing Z-order seems to have no (or wrong) effect in designer
- in compiled application Z-order seems to work as expected

Zeljan Rikalo

2015-03-16 19:19

developer   ~0082018

So it's regression and must be fixed.

Zeljan Rikalo

2015-03-16 19:20

developer   ~0082019

I've updated bug info, because this is regression

Bart Broersma

2015-03-17 18:47

developer   ~0082038

This is getting weird.
I just tested the same setup as yesterday (r48395): the Z-ordering behaves as expected both inside IDE and in the built program.
(Yesterday it showed the bug.)
This makes testing rather difficult.

Zeljan Rikalo

2015-03-17 20:10

developer   ~0082041

Possible uninitialized variable.

Zeljan Rikalo

2015-03-17 21:03

developer   ~0082042

Lazarus 1.5 r48332
 FPC 3.1.1 i386-linux-qt
Z-order works perfect.

Zeljan Rikalo

2015-03-17 21:07

developer   ~0082043

Also Lazarus 1.5 r48332
 FPC 3.1.1 i386-linux-gtk2 works fine.

Zeljan Rikalo

2015-03-18 12:56

developer   ~0082066

Tested on Mint 17 64bit with cinnamon and it works ok.

Mike Thompson

2015-03-27 21:35

developer   ~0082384

Last edited: 2015-03-27 21:40

View 2 revisions

If this is a regression, this may go further back. While I was working on http://bugs.freepascal.org/view.php?id=20450, I could not initially get the Object Inspector to correctly display the Z-Order.

In the end I added some additional code to objectinspector.pp procedure TObjectInspectorDlg.DoZOrderItemClick(Sender: TObject); that forced the OI to update the order of the controls.

There was also some oddity I saw with the Menu Item Z-order in the OI, and I had to add similar OI refresh code there. That code was even earlier :-( And there was one or two users in the forum who were telling me that they didn't see a problem with the Z-Order at all.

Reason I mention this is the order of controls in the LFM is identical to the order of controls in the OI.

Mike Thompson

2015-03-27 22:22

developer   ~0082385

Last edited: 2015-03-27 22:28

View 3 revisions

Focussing on just the reported issue here, I'm possibly confused.

> 1) When the form is reduced in width by dragging the right side,
> the comboboxes and btn2 slide over btn1. They should slide under.

btn1 is the first item in the OI list. I would have thought this puts it at the back of the Z-Order. Other controls sliding over this is what I would expect. It's also what I'm seeing here (in Windows) - both at design time, and at runtime. Is my understanding incorrect?

Zeljan Rikalo

2015-03-27 23:16

developer   ~0082386

This example works correct here. Btn1 is at the bottom of the stack so covered by other controls when resizing form. Moving btn1 Z order to the top, controls goes below btn1 when form is resized (reduced size). So no issue here.
Fedora 19 64bit, KDE, tested qt,gtk2 and win32 via wine. All of them works correct.

Bart Broersma

2015-04-07 18:22

developer   ~0082700

Since the bug cannot be reproduced in a reliable way, I removed target 1.4 (even though it may be a regression).

If there is anybody who can repdoduce it in a reliable way, please try to find the revision that broke it (use disecting).

Martin Friebe

2015-04-07 19:58

manager   ~0082702

@Mike: You wrote
"Closing Lazarus and editing the .lfm file in a text editor changes the order in the Object Inspector. But, even after Clean and Rebuild it only shows changes in the Object Inspector. The z-order when the application is run, does not change. "

There should be a copy of the lfm file in the lib folder (with the ppu and o files. Did this copy get updated?

I wonder why there is an lrs file. That should not be there.
Project Options > Miscellaneous "FPC Resources is selected"
Though at the same time (and that makes no sense afaik) "save lrs file in the output dir" but maybe that affects the res file too.

Bart Broersma

2015-04-07 20:02

developer   ~0082703

@Martin: OTOH I have reproduced (but not reproduced it since) this on a fresh project, using FPC resources (not .lrs) and without manually editing the .lfm.

Juha Manninen

2021-03-06 18:02

developer   ~0129445

Z-order works.
It can be seen when Lazarus and the app are built with QT5. The designer correctly changes order in .lfm file.
GTK2 behaves wrong and does not obey Z-order. The related issue stays open for that.

Reinhard Buchholz

2021-03-12 14:18

reporter   ~0129602

I thing everything works fine till the call in wincontrol.inc in line 4245, where
TWSWinControlClass(WidgetSetClass).SetChildZPosition(Self,
                              TWinControl(AChild), OldPos, NewPos, WinControls);
is called. I think, this is the routine in the widgetset, in my case GTK2.

https://wiki.freepascal.org/GTK2_Interface#Road_map_for_the_gtk2_interface
reports:
"In Gtk2 many controls don't have a window, so they are just painted on their parent. This makes they be painted before controls with a window, so we get a wrong Z-Order. "

Wouldn't it be a good idee to pick uo the proposal of the mentioned tutorial, to put these controls in an eventbox automatically?

Issue History

Date Modified Username Field Change
2015-03-05 21:41 Mike Sapsard New Issue
2015-03-05 21:41 Mike Sapsard File Added: published.zip
2015-03-06 10:18 Mike Sapsard Note Added: 0081673
2015-03-06 19:46 Juha Manninen Note Added: 0081685
2015-03-14 12:07 Zeljan Rikalo Relationship added related to 0027419
2015-03-16 11:58 Mike Sapsard Note Added: 0082002
2015-03-16 15:06 Zeljan Rikalo Note Added: 0082011
2015-03-16 18:57 Bart Broersma Note Added: 0082017
2015-03-16 18:58 Bart Broersma Note Edited: 0082017 View Revisions
2015-03-16 19:19 Zeljan Rikalo Note Added: 0082018
2015-03-16 19:20 Zeljan Rikalo LazTarget => 1.4
2015-03-16 19:20 Zeljan Rikalo Widgetset GTK 2, QT => GTK 2, Win32/Win64, WinCE, Carbon, Cocoa, QT
2015-03-16 19:20 Zeljan Rikalo Note Added: 0082019
2015-03-16 19:20 Zeljan Rikalo Priority normal => high
2015-03-16 19:20 Zeljan Rikalo Severity minor => major
2015-03-16 19:20 Zeljan Rikalo Summary Setting z-order of objects does not work => Setting z-order of objects does not work - regression
2015-03-17 18:47 Bart Broersma Note Added: 0082038
2015-03-17 20:10 Zeljan Rikalo Note Added: 0082041
2015-03-17 21:03 Zeljan Rikalo Note Added: 0082042
2015-03-17 21:07 Zeljan Rikalo Note Added: 0082043
2015-03-18 12:56 Zeljan Rikalo Note Added: 0082066
2015-03-27 21:35 Mike Thompson Note Added: 0082384
2015-03-27 21:40 Mike Thompson Note Edited: 0082384 View Revisions
2015-03-27 22:22 Mike Thompson Note Added: 0082385
2015-03-27 22:23 Mike Thompson Note Edited: 0082385 View Revisions
2015-03-27 22:28 Mike Thompson Note Edited: 0082385 View Revisions
2015-03-27 23:16 Zeljan Rikalo Note Added: 0082386
2015-03-27 23:46 Juha Manninen Relationship added related to 0020450
2015-04-07 18:22 Bart Broersma LazTarget 1.4 => -
2015-04-07 18:22 Bart Broersma Note Added: 0082700
2015-04-07 19:58 Martin Friebe Note Added: 0082702
2015-04-07 20:02 Bart Broersma Note Added: 0082703
2017-06-14 20:37 Juha Manninen Relationship added related to 0032010
2021-03-06 18:02 Juha Manninen Assigned To => Juha Manninen
2021-03-06 18:02 Juha Manninen Status new => resolved
2021-03-06 18:02 Juha Manninen Resolution open => fixed
2021-03-06 18:02 Juha Manninen Widgetset GTK 2, Win32/Win64, WinCE, Carbon, Cocoa, QT => GTK 2, Win32/Win64, WinCE, Carbon, Cocoa, QT
2021-03-06 18:02 Juha Manninen Note Added: 0129445
2021-03-12 14:18 Reinhard Buchholz Note Added: 0129602