繁體 简体

Q&A: Using the status bar to show the results if user calculations

Question
I want to use the status bar to show the result of a special calculation that I create. How can I do this? Will the status bar be updated on a continuous basis?

Synopsis
Using the status bar to show the results if user calculations

Symptoms
This is certainly possible to do in OSLO. There will be some programming involved and a couple of steps need to be done in different places in OSLO. But if you have the time to follow this example, you will learn a lot about how OSLO programming works.

For the purposes of this example, let’s assume that you want to see the value of the overall length of your model in field #4 of the status bar.

Solution
This process will involve a few major steps:

  1. Set field #4 of the status bar to display “Status Bar Preference”
  2. Create a program that calculates the system overall length and then set an OSLO preference using the data formatted as a string
  3. Place the program in a “callback” function that will get repeated whenever a change is made to the surface data spreadsheet.
  4. Set the callback level of OSLO so that the callback function gets executed whenever a change is made to the Surface Data Spreadsheet.
    To help this process, two CCL programs have already been written for this exercise. Extract these two programs and place them in your Private CCL directory. Then re-compile your private CCLs. A quick way to do this is to click on the “gear” icon in the Standard tollbar of the Main OSLO Window.

Detailed Steps:

  1. Go to menu item “Window>>Status Bar” and set field #4 to “Status bar preference”.
  2. Go to your private CCL directory and open the Tools_StatusBar.ccl file with a text editor (the OSLO editor is a good choice: “Window>>Editor>>Open”). This is one of the files that is provided with this example. The OALset command described within this file calculates the overall length of The file is heavily commented and should be fairly explanatory even if you don’t know CCL syntax that well. If you need to change this file for your own purposes, it should be obvious how to change it.

30051 新竹市經國路二段160號9F-8
Tel : 03-5359299  Fax: 03-5358908
統編: 28521213

光學軟體設計領導者

© 2018 All rights reserved. Setup by Eidea