Search code examples
delphiobjectlabelframeinvisible

Delphi 7: objects on frame aren't rendered (bug?)


I'm using a frame to cover several objects on a parent form. The frame contains a progress bar, a label and a button. When I activate the frame, only the progress bar is rendered. The label and the button stay invisible. Setting .enable + .visible to true in the code upon showing the frame doesn't work either. I can see the objects perfectly fine in the IDE. They disappear only at runtime.

I read on this thread that there seems to be a bug in Delphi 7 that might cause this behavior, but I'm not sure:

http://www.delphigroups.info/2/7/734850.html

Is there a workaround to get Delphi to render all of the frame's objects?

Update: dfm-code for frame

object Frame2: TFrame2
  Left = 0
  Top = 0
  Width = 528
  Height = 116
  TabOrder = 0
  object Label1: TLabel
    Left = 8
    Top = 8
    Width = 32
    Height = 13
    Caption = 'Label1'
  end
  object Button1: TButton
    Left = 8
    Top = 72
    Width = 75
    Height = 25
    Caption = 'Button1'
    TabOrder = 0
  end
  object ProgressBar1: TProgressBar
    Left = 8
    Top = 32
    Width = 473
    Height = 24
    TabOrder = 1
  end
end

Solution

  • Alright, I found the error and I'm quite ashamed since it's a rather obvious one:

    Upon button click the frame is being rendered including all its objects, however, the click also initializes a CPU-intense function. Since this was early code, I hadn't implemented threading yet, so the function froze the gui-rendering and thus prevented some objects to appear. This was "fixed" when I commented out the function. I was also thrown off by the fact, that the progress bar on the frame not just appeared, but kept updating despite the CPU-usage.

    Thanks again to all of you who replied.