Guides and Articles

Use this documentation when building your Tekla Structures apps

Keep tool always above Tekla Strucures

Updated: 13 May 2019

This guide introduces two options on how to keep the tool above Tekla Structures:

  1. Set Tekla Structures to be the parent form of the tool and call API methods inside a thread (see Keep logic and user interface separate).
    For example, all picker calls must be done with asynchronous calls; that is, with background worker. It is not possible to use picker from dialog thread if child windowing is used. 
    private void button1_Click(object sender, EventArgs e)
        System.ComponentModel.BackgroundWorker BackgroundWorker = new System.ComponentModel.BackgroundWorker();
        BackgroundWorker.DoWork += delegate
            Picker P = new Picker();
                ModelObject MO = P.PickObject(Picker.PickObjectEnum.PICK_ONE_OBJECT) as ModelObject;
                    MessageBox.Show("Numbering not UpToDate");
            catch { }
  2. Do not set the parent form of the tool but instead force it to be topmost or modal.

    The simplest way to set the tool above Tekla Structures is to show the tool as a child of the Tekla Structures window. This requires a small change in the startup code. The examples below uses Tekla application library.

  3. Change the startup code (usually in Program.cs file) from this: 

    Application.Run(new Form1());
     to this: 
    Form1 form1 = new Form1();

    Now the tool acts as a child window and stays always on top of the Tekla Structures main window. The tool is also hidden when the main window is minimized. 

Was this helpful?
The feedback you give here is not visible to other users. We use your comments to improve the content.