Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Hiding certain *visual* controls in TLMDDesignPanel (LMD2013).

There's a handy 'OnShowNonvisualComponent" event for hiding non-visual components, but I'd like a way of selectively hiding certain visual one. (we want to fake up a 'layering' system, and allow user to only see controls on a certain layer.

Is there any way of doing this with DesignPack, short of temporarily deleting the components from the panel and adding them back later, which is a bit of a sledgehammer approach? Would be a great feature...
Tagged:

Comments

  • 7 Comments sorted by Votes Date Added
  • Hi,

    There no special feature in DesignPack, because it work on top of VCL system. However, I see two possibilities:

    1) To prevent controls destruction and recreation simply change its Parent, where you need.

    2) Look at csNoDesignVisible standard flag. Search VCL source code to learn how it used in standard controls.
  • Thanks. Setting Parent = NULL seems a good way forwards. csNoDesignVisible doesn't seem to be observed by designpack. 
  • Hi,

    csNoDesignVisible should work. There no need for some special code inside DesignPack for this thing to work. It handled fully inside VCL code...

    However, changing Parent  is of course simpler...
  • Just a followup on this, for anyone interested.

    Changing Parent=NULL to make objects disappear from the designer is a bad idea, as when you set it back to the real parent, the Z order changes!

    Manually adjusting the ComponentStyle property to include csNoDesignVisible didn't seem to work for me - but TControl objects have a "SetDesignVisible(bool)" method, and this works perfectly.
  • I spoke too soon: The designer doesn't always respect the csDesignerHide flag, because 'invisible' objects can still be selected by clicking in the designer window, which defeats the point of hiding them.

    However, luckily this can be handled using the slighlyl mis-spelt "OnGetTransparence" event.

    void __fastcall TMainForm::LMDDesigner1GetTransparence(TObject *Sender, TControl *AControl,
              bool &ATransparent)
    {
      ATransparent = AControl->ControlState.Contains(csDesignerHide);
    }

    It could be good to have this functionality directly within TLMDDesigner?
  • Hmmm. You right, this looks like a bug. I'll fix it.
Sign In or Register to comment.