Howdy, Stranger!

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

In this Discussion

DockManager LoadFromFile query

Hi there,

We have recently purchased the LMD DockingPack 2016 with a view to incorporating the docking controls into an existing application.

Because I do not have the option of building the dockable framework from scratch I have to retrofit the docking component framework into the existing application form structure.
I am working my way through it and making progress and like the look and feel of the controls but had a few questions:

1. When dynamically creating panels (ClientKind=dkTool), saving them to xml is fine but they will not load via TLMDDockManager.LoadFromFile. I read a support item that discussed using the OnGetComp event but I would like an example of how to use this event properly.

2. Further to this I thought I could use the OnReadAppInfo and the OnGetComp to get my forms associated with the Panels as they are loaded but it appears the event order is the wrong way around for that. So I am also looking for a useful way to use OnReadAppInfo for my custom xml content to align with the panels layout when the xml is loaded. Again a workable example here would be extremely useful.

I hope this all makes sense and if you need more information please let me know.

Comments

  • 4 Comments sorted by Votes Date Added
  • Hi,

    I didn't quite understand what is you problem, however:

    1) If your applicartion allows dynamic panels (forms), then you have to keep track in some global list of such forms. And you have to associate Unique ID with each of such forms. This is up to you, how you will implement it. 
    So, when layout is loading in OnGetComp even handler you should search for already existing form with provided ID, and if its not yet exist (in case application has beed restarted, ect) you need to dynamically create such a form.

    2) Following the way, described in (1), you can realize that provided by the event Unique ID is not sufficient to dynamically create your form/panel, because some more creation parameters are required. This way, you right, you can use additional AppInfo, previously stored inside layout XML. The event, which will allow you to read such info before real layout loading is - BeforeRead.



  • Ah, I must admit I didn't notice BeforeRead there. I will try that.

    I realise that I must keep my custom form structure in a global list and match it up with the panels as they're created and have built a framework to do this.

    One thing that I am still not understanding though is in the OnGetComp I have to evaluate every ID coming through the event to make sure I am only creating and assigning the custom panels that were dynamically created and saved last time the application was run.
    By this I mean I have to ignore <site id=frmDashboard.MainDockSite> and also there is a blank ID that comes through which I am assuming is the main docking sites default panel. To illustrate, here is a sample of the xml:

    <?xml version="1.0" encoding="utf-8"?>
    <sitelist>
    <site floating="1" left="2647" top="481" width="1065" height="485">
    <zone kind="PANEL" id="pnlTestDocking" visible="1"/>
    </site>
    <site id="frmDashboard.MainDockSite">
    <zone kind="PANEL" isspace="1"/>
    </site>
    </sitelist>

    I have it working but it seems a bit fragile, so again it would be much appreciated to know exactly how to implement this event even if it is just to create the dockpanels.
    Also, the next time I the xml is saved, the dynamically created panels have the ID prefixed with the docksite name as such:

    <zone kind="PANEL" id="frmDashboard.MainDockSite.pnlTestDocking" visible="1"/>

    This creates more leg work for me to strip out this part as I cannot assign the DockPanel name this ID when creating it again in the OnGetComp event.

    I really appreciate the help and am finding the components very useful but I just need this little part made crystal clear so that I can be sure I am using it correctly.

    Cheers.

  • Hi,

    About IDs: docking pack provide a built-in way to generate IDs for simplicity, in case you are not dealing with dynamic forma and OnGetComp event. As you can mention in this case (by default) component names are used. Again, this is done as a default implementation for simplicity of small applications.

    But, if you have dynamic panels, you HAVE TO provide YOUR OWN Unique IDs (which, probably, need to be stored with the forms in your global list). So, OnGetComp event should be always used in pair with OnGetCompId event. This is also up to you how to generate these IDs, for example you can have some fixed prefix and a GUID:

    MYAPP_ID_196D2CEE-E20C-4EBE-A342-69EA479A4D76

    Another example will be to use some auto-increment number, such as:

    MYAPP_ID_000001

    Its up to you...
  • Thanks Eugene, I will give that a try
Sign In or Register to comment.