6 Replies Latest reply on Dec 5, 2016 8:36 AM by Nocodes79

    Resize docking window via code

    Nocodes79

      Hi everybody,

       

      we have a custom docking window to show a treeview of an AF DB in processBook.

      We  can easily edit the docking window width at add-in connection.

      this.dockWindow.Width = width;
      

       

      Now we have to change its width when the add-in changes to pinned to unpinned. We subscribed the event

      this.dockWindow.Show += dockWindow_Show;
      

      Then we try to edit the width:

        private void dockWindow_Show(bool Show, bool Pinned)
              {
                  if (Pinned)
                  {
                      this.dockWindow.Width = 230;
                          
                  }
                  else
                  {
                      this.dockWindow.Width = 400;
                  }
              }
      

      Anyway the new width is not applied. We also tried setting the width at view and ctrlView level, but this are read-only.

       

      Is there a way to resize a docking window via code?

        • Re: Resize docking window via code
          Kenji Hashimoto

          Hi Nicola,

          I tried it but unfortunately .Show event does not catch event when I pinned/unpinned the docking window.

          My code was following.

          m_dockWindow.Show += new EPBDockWindow_ShowEventHandler(dockWindow_Show);
          private void dockWindow_Show(bool Show, bool Pinned)
          {
                  MessageBox.Show("Show event happened");
          }
          

          From PI ProcessBook, if I close or reopen the custom docking window by View > custom docking windows name, then it shows MessageBox("Show event happened").

          I think we need to use different events for pinned/unpinned events.

            • Re: Resize docking window via code
              Kenji Hashimoto

              Ah sorry, I mistook the "pinned" meaning.

              Do you mean this one?

              Then it runs .Show event. I tested and I could not change width by this code though.

              private void dockWindow_Show(bool Show, bool Pinned)
              {
                  MessageBox.Show("Show event happened");
                  m_dockWindow.Width = 500;
              }
              

               

              I will research about it.

              2 of 2 people found this helpful
              • Re: Resize docking window via code
                Nocodes79

                Thank you Kenji,

                 

                it looks like there is no pin/unpin event or at least I could not find it.

                This was the reason we used the show event. The problem is that window's width cannot be changed while unpinned, while it looks like it is proportional to the pinned docking window width (should be better checked).

                 

                If it is not possible editing the unpìnned width of the docking window, we would then need to get some kind of BeforeDockWindowUnpin event, but I could not find one.

              • Re: Resize docking window via code
                Eugene Lee

                Hi Nicola,

                 

                Top, Left, Width and Height properties are read-only if the docking window is set to unpinned. While no error is returned, the values set are ignored. Unpinned docking windows in Processbook cannot be resized or moved through automation or the GUI. In addition, the Top and Left properties do report correct values for unpinned windows if that window has never been shown (rolled-out) at least once. These properties report the window in position (400, 400).

                 

                Floating docking windows default to the "pinned" state.