User Interaction

 

function Input(XPos,YPos,Caption,Default)

Shows an input box and returns the user input string. If the user cancelled the input box, the string 'CANCEL' is returned.
XPos, YPos The position of the upper left corner of the input box in pixels, relative to the main window
Caption The caption of the input box.
Default The default input string.

Example
// create a time control list containig the times of full moon 
// of a year, specified by the user
var
  i   : integer;
  year: integer;
  JD  : double;
begin
  TimeScale := UT;
  TimeShift := StdTimeZone;
  year := YearFromJD(Now);    // determine current year
  // ask for year of calculation, use current year as default value
  year := Input(50,150,'Enter year number',year);
  // perform the calculation
  JD := JulianDay(year,1,1,0,0,0)-5.0;
  for i:= 1 to 13 do begin
    JD := LunarPhase(JD,Full);
    Add(JD);
    JD := JD + 5.0;
  end;
end;

 

function Selection(XPos,YPos,Caption,Items,ItemIdx)
Shows a selection box and returns the string which was selceted by the user. If the selection box was cancelled, the string 'CANCEL' is returned.

XPos, YPos The position of the upper left corner of the input box in pixels, relative to the main window
Caption The caption of the selöection box.
Items The items shown in the selection box, delimited by semicolons (;).
ItemIdx The (zero-based) index of the selected item.

Example
// show a selection with oppostion times (1990-2022) of Mars
// calculate an ephemeris of 250 values prior and 250 values after 
// the user selected opposition date with a tep size of 12 hours
var s: string;
begin
  TimeScale := UT;
  TimeShift := StdTimeZone;
  repeat
    s := Selection(50,150,   // the position of the selection box
                   'Select opposition date',            // the caption
                   '1990-11-27;1993-01-07;1995-02-12;'+ // the items
                   '1997-03-17;1999-04-24;2001-06-13;'+
                   '2003-08-28;2005-11-07;2007-12-24;'+
                   '2010-01-29;2012-03-03;2014-04-08;'+
                   '2016-05-22;2018-07-27;2020-10-14;'+
                   '2022-12-08',
                   8);  // select item index 8 (2007-12-24)
  until (s <> 'CANCEL');
  // perform the calculation (250 steps prior and after the selected date)
  JD0       := s;           // the result from the selection
  StepsA    := 250;
  StepsB    := 250;
  StepSize  := '12:00';     // 12 hours
  CreateList;
  Goto(JD0);                // select row that corresponds to selection
end;


procedure GoTo(JD)

Selects that row of the ephemeris table that corresponds to the time specified by JD.


Alcyone Ephemeris Documentation
(C) 2007 Alcyone Software