Forums

Find answers, ask questions, and connect with our
community all around the world.

Home Forum Omnis General Forum Positioning Studio/IDE windows by code

  • Positioning Studio/IDE windows by code

    Posted by Uwe Smidt on January 1, 2024 at 3:14 pm

    Dear $all,

    Happy New Year to you!

    One wish of mine for the new year ist to be able to better control the windows of my Omnis Studio environment. Since I’m working with a MacBook / Macbook+external monitor interchangingly, the ‘save Window setup’ does not really help when I’m switching to the other environment – I have to reposition all windows by hand, i.e. mouse.

    While I’m still waiting to be heard (https://www.omnis.net/community/forums/forum/discussion/saving-named-workspaces/), is there a way to position e.g. the property window programmatically?

    But I can’t find any reference to property window, Browser, Inheritance, catalogue etc.

    Maybe you have an idea!

    Thank you!

    Uwe

    Andreas Pfeiffer replied 6 months, 3 weeks ago 2 Members · 7 Replies
  • 7 Replies
  • Andreas Pfeiffer

    Administrator
    January 2, 2024 at 8:09 am

    Hi Uwe,

    How about making a copy of your Omnis installation? You could then simply have one version with and another without the external monitor.

    Best,

    Andreas

    • Uwe Smidt

      Member
      January 2, 2024 at 2:27 pm

      Dear Andreas,

      Happy New Year to you!

      Yes, this might be a workable workaround.

      But then I’d have to manage double pref files as config.json, omnis.cfg, sql.df1, query.df1.

      <font face=”inherit”>Do you know in which file the last environment is stored in? So I might just exchange that file via script, instead of doubling </font>the<font face=”inherit”> whole Studio installation.</font>

      Thank you!

      Regards

      Uwe

  • Andreas Pfeiffer

    Administrator
    January 2, 2024 at 11:06 am

    Uwe,

    For the Omnis Studio IDE Browser I found a solution that you might want to use:

    Create an instance variable i.e. “iBrowserRef” in the Startup_Task of your library. Then make a method that allows to set the $top, $left, $width and $height property. If you make it a public method you could reach this method from anywhere else in the task context. For example you could create a window class that allows to call this method, i.e. Do $ctask.$setBrowserProps(10,10,600,400)

    Now in the first line of the $construct of your remote task type the following to set the reference:

    Set reference iBrowserRef to $topwind

    The reference should now hold the reference to the browser. However there are a few caveats. If you close and re-open the browser, the reference will be invalid. If you open multiple instances of your browser the reference will only go to the one browser instance that was open, when the library has been opened.

    Also this is not a solution for the Property Manager, as this one is a C++ window and not an Omnis window.

    Best,

    Andreas

    • Uwe Smidt

      Member
      January 2, 2024 at 2:35 pm

      Dear Andreas,

      Thanks for your response!

      Ironically, the Browser window is alway in the right place, but the Property and the Catalog window are the ones most needed and always in the wrong place 😉

      But at least I now understand why I don’t ‘see’ them in Omnis Notation Inspector…

      Regards

      Uwe

  • Uwe Smidt

    Member
    January 6, 2024 at 12:02 pm

    Dear $all,

    when trying to implement an automation of ‘switching between Omnis.cfg files per environment’, I came across an old Zombie🧟‍♂️: AppleScript! And Omnis does still support it, e.g. moving windows around. Below are some lines of code that do the job. Now I only needed the script to be executed with a keyboard shortcut – for which I found no working built-in solution.

    So I came across a utility called ‘Keyboard Maestro’ which did the rest: triggering the macro with a keyboard shortcut, and then calling the script ‘mobile’ if only one screen is present, or calling ‘Desktop’ if an external screen is present, too. Eh voila – I’ve got all my windows sorted nicely 😊!

    set vtop to 25
    set vleft to 0
    set vright to 3008
    set vbottom to 1692
    set vBottomRowTop to 1390
    set vOffset to 30
    set vStackForms to 0
    set vStackMethods to 0
    tell application "Omnis Studio 11 35659"
    set WinList to name of windows
    --display dialog WinList
    repeat with currentWindow in WinList
    set currentBounds to bounds of window currentWindow
    --display dialog currentWindow & ": " & currentBounds
    if currentWindow contains "Studio Browser" then
    set bounds of window currentWindow to {vleft, vtop, 1000, 800}
    else if (currentWindow begins with "rf" and currentWindow contains "methods") or (currentWindow begins with "ta") or (currentWindow begins with "tv") then
    -- Remote Form Methods, Table Class methods
    set bounds of window currentWindow to {1360 + vStackMethods, vtop + vStackMethods, 2360 + vStackMethods, 800 + vStackMethods}
    set vStackMethods to vStackMethods + vOffset
    else if currentWindow begins with "rf" and currentWindow contains "Grid" then # Remote Form
    set bounds of window currentWindow to {300 + vStackForms, vtop + vStackForms, 1200 + vStackForms, 450 + vStackForms}
    set vStackForms to vStackForms + vOffset
    else if currentWindow begins with "rf" then # Remote Form
    set bounds of window currentWindow to {300 + vStackForms, vtop + vStackForms, 1200 + vStackForms, 700 + vStackForms}
    set vStackForms to vStackForms + vOffset
    else if currentWindow contains "Component Store" then
    set bounds of window currentWindow to {vleft, 900, 199, vBottomRowTop - 1}
    else if currentWindow begins with "Field List" then
    set bounds of window currentWindow to {200, 900, 1100, vBottomRowTop - 1}
    else if currentWindow contains "Property Manager" then
    set bounds of window currentWindow to {2620, vtop, vright, 1014}
    else if currentWindow begins with "Catalog" then
    set bounds of window currentWindow to {2620, 1015, vright, vbottom}
    else if currentWindow contains "ucConstants" then
    set bounds of window currentWindow to {vleft, vBottomRowTop, 799, vbottom}
    else if currentWindow contains "Notation Inspector" then
    set bounds of window currentWindow to {800, vBottomRowTop, 1139, vbottom}
    else if currentWindow contains "Inheritance Tree" then
    set bounds of window currentWindow to {1140, vBottomRowTop, 1480, vbottom}
    end if
    end repeat
    end tell


    • Andreas Pfeiffer

      Administrator
      January 8, 2024 at 8:10 am

      Uwe,

      Nice one!

      Best,

      Andreas

Log in to reply.