Lazarus

Programming => LCL => Topic started by: wittbo on August 06, 2017, 12:16:57 am

Title: TLabel over TPanel
Post by: wittbo on August 06, 2017, 12:16:57 am
Hello,
inspired by carl_caulketts solution of a movable Panel (in the macOS subsection), i developed a movable Label as cross platform drag&drop solution, since drag&drop does not seem to be implemented on macOS/cocoa. OK, everything works fine, moving and dragging the label no problem, macOS/carbon and macOS/cocoa ok. But, after compiling and running with windows XP, the Label disappears behind the Panel, whereas with macOS the TLabel floats in front of the TPanel, shit.
Which is the to be expected behavior, the macOS or the windows behavior? Why is one of the platforms wrong?
Any idea?
Title: Re: TLabel over TPanel
Post by: taazz on August 06, 2017, 12:33:55 am
a Tlabel is a TGraphicControl descendant. TGraphiControls can be considered as virtual controls they do not exists from the system's point of view they are handled completely from the framework, as such they are painted when their parent is painted, as a result they are always painted before all the TWinControl descendant children, which handle communication with the OS on their own. That is on windows at least and probably QT as well.

Title: Re: TLabel over TPanel
Post by: Eugene Loza on August 06, 2017, 01:27:37 am
Quote
compiling and running with windows XP, the Label disappears behind the Panel
I can't compile the project on Linux. For some reason CarbonBars (which is not in "uses") argues that it requires MacOSAll.
I've tried to override z-order of the classes for a clean test project, but in any case TPanel draws over TLabel unless it's "visible=false". While z-order works perfectly for 2 TPanels, and also for TEdit, TButton, TMemo, etc... only TLabel seems to be ignored completely... Really unexpected.
Only assigning TLabel parent to be TPanel it is drawn over TPanel (but not over TForm anymore).

I can see the only workaround:
Make the label not a TLabel, but a TPanel with BevelOuter=bvNone, thou you can only have a label over a color this way, you can't make it transparent (showing only text).
Title: Re: TLabel over TPanel
Post by: taazz on August 06, 2017, 01:31:47 am
Make the label not a TLabel, but a TPanel with BevelOuter=bvNone, thou you can only have a label over a color this way, you can't make it transparent (showing only text).
use tstatictext instead of tpanel.
TinyPortal © 2005-2018