Howdy, Stranger!

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

In this Discussion

Problems with undocked forms

(Copied from the newsgroups as no response)

There is still the problem with the object inspector switching between components when you try to edit the component of a floating form.

You can reproduce it in the IDE2 demo as follows:

1. Undock the default form
2. Create a second form and leave it docked
3. Add a RadioButton to the undocked form
4. Add a Checkbox to the docked form. 
5. Click on the RadioButton and make sure the OI is showing the correct
component.
6. Click on the Checkbox and make sure the OI is now showing the
Checkbox.
7. Click on the header of the undocked forms floating border - the OI
changes to the RadioButton.
8. Click on a property in the OI and you will see the component change
back to the Checkbox.

Regards
Keith.

Comments

  • 8 Comments sorted by Votes Date Added
  • The demo is only a demo. I know, what you speak about...
    But, currently, IDE-manager is implemented so, that it treat designer as active only when it has focus. If you need some other "active-designer" (or say "last active designer") algorithm, you need to implement it manually; or at least try to tune ide-manager.
  • Hmm,  so basically I can't use the the new tabbed panels as-is with the library?  I implemented the fix you suggested by reacting to ControlChanged which solved most of my problems,  but this problem is still there and I cannot see how to fix it.  I noticed that there was a AutoCurrentDesigner property in the IDEMgr,  but turning this off and setting the CurrentDesigner from the ControlChanged event doesn't seem to solve the problem as the event gets fired with the embedded OSDesignPanel when you click on the object inspector for some reason.
  • Yes, I meant AutoCurrentDesigner. So, I can't understand your problems now, because you have full freedom, of how and when to set CurrentDesigner; thus - this is your way of which designer to treat as current.

    From my viewpoint, its very easy to use TLMDDesignPanel.OnEnter even to switch between designers.
  • Ok,  I'll look into it further.  What seems to be happening is that when the click occurs in the object inspector,  the controlchanged event is called multiple times and one of those times is with the embedded LMDDesignPanel as the current component,  I'm not sure why yet.  This means that if I use this event to set activedesigner (which is what I think I would need to do as Enter isn't called if you click the header of a floating panel?), the same problem occurs as with AutoCurrentDesigner set to true. 

    The layout is similar to the IDE2 layout which is why I tend to use it show up problems that I'm also having.
  • I've now tested this, adding an event to LMDDesignPanel.OnEnter to set the current designer.  This doesn't work because clicking on the header of a floating panel does not fire the event.  Therefore I also set the current designer when the Application ControlChanged event is called with a control contained by one of my EditorFrames.  This then behaves exactly as the code does with AutoCurrentDesigner set,  so it seems to me that the problem is not solvable this way? 
  • Posts: 0 Accepted Answer Vote Up0Vote Down
    Ok, I've investigated my time to look at this problem deeper and found the following:

    - Any form in VCL architecture remembers its last active control (in its ActiveControl property) and attempts to focus it automatically on form activation. This is the main problem. Specifically:

    - On floating form activation, main form remembers that the docked designer was focused.
    - On property inspector click the main form is activated (BEFORE any other click processing), and on activation restores focus to docked designer.

    So, to solve the problem you just need to RESET main form's ActiveControl when other designer become the current designer. The code is simple:

    procedure TfrmMain.IDEMgrCurrentDesignerChange(Sender: TObject);
    begin
      if not Self.Active then
        ActiveControl := nil;
    end;

    I've checked, it works.
  • Brilliant! - thanks very much for taking the time to solve this. 
Sign In or Register to comment.