DropList upon Opening window

I have a drop list that does not seem to want to populate strings in my window, but only when the window is first opened. I have the list set to select the first value upon opening. Otherwise, selecting a value from the drop list will correctly populate the strings, just not upon opening. Here’s the drop list properties:

image

Here’s the window just after opening, drop list not touched:
image
I put the Mac:MachineName field below the box to prove to myself that the data selected as the first from the list is present upon opening the window.

Here’s the code that is executed when a value is selected in the drop list:
LOC:MachineName = Mac:MachineName
DO FillCalendarSchedule

This code is executed upon opening the window:
LOC:MachineName = Mac:MachineName
Do FillCalendarSchedule

FillCalendarSchedule is the routine that fills the strings with the appropriate values. Works fine when a value is selected with the drop list. THe Routine does not seem to want to fill uopn opening the window.

are you doing the fill routine before the tables are opened?

I would think the lists are filled before the After Opening Window Embed, but I will check. Thanks for the speedy reply.

I am pretty sure it’s the last thing done.

The routine (PrepareProcedure) that sets up the window is after the window & date declarations and just before the ACCEPT LOOP.

! End of "Data Section, After Window Declaration"
  CODE
  PUSHBIND
  ! Start of "Initialize the Procedure"
  ! [Priority 5000]
  
  ! End of "Initialize the Procedure"
  LocalRequest    = GlobalRequest
  OriginalRequest = GlobalRequest
  LocalResponse   = RequestCancelled
  ForceRefresh    = False
  CLEAR(GlobalRequest)
  CLEAR(GlobalResponse)
  ! Start of "Procedure Setup"
  ! [Priority 5000]
  
  ! End of "Procedure Setup"
  IF KEYCODE() = MouseRight
    SETKEYCODE(0)
  END
  DO PrepareProcedure    !<======================
  ! Start of "Preparing to Process the Window"
  ! [Priority 5000]
  
  ! End of "Preparing to Process the Window"
  ACCEPT
    ! Start of "Accept Loop, Before CASE EVENT() handling"

*Here's the Template generated Routine that sets up the window and my code is at the bottom:*


PrepareProcedure ROUTINE
  ! Start of "Beginning of Procedure, Before Opening Files"
  ! [Priority 5000]
  
  ! End of "Beginning of Procedure, Before Opening Files"
  IF Machines::Used = 0
    CheckOpen(Machines,1)
  END
  Machines::Used += 1
  IF People::Used = 0
    CheckOpen(People,1)
  END
  People::Used += 1
  IF ScheduleDatesMachines::Used = 0
    CheckOpen(ScheduleDatesMachines,1)
  END
  ScheduleDatesMachines::Used += 1
  IF Sessions::Used = 0
    CheckOpen(Sessions,1)
  END
  Sessions::Used += 1
  FilesOpened = TRUE
  DO BindFields
  ! Start of "Beginning of Procedure, After Opening Files"
  ! [Priority 5000]
  
  ! End of "Beginning of Procedure, After Opening Files"
  ! Start of "Before Opening the Window"
  ! [Priority 4000]
  LOC:DayNum = TODAY()%7    ! day#  0-6
  
  ! End of "Before Opening the Window"
  OPEN(DateWeekStartWindow)
  WindowOpened=True
  ! Start of "After Opening the Window"
  ! [Priority 4000]

*! My code is next* 

  LOC:DayStart = TODAY() - LOC:DayNum   ! Calculate what date to the calendar on 9i.e. start on Sunday)
                                        ! LOC:DayNum is an integer 0-6 for DOW, 0=SUN
  LOC:MachineName = Mac:MachineName
  
  Do FillCalendarSchedule  ! sets dates in headers
  
  ! End of "After Opening the Window"

In Legacy the Browses are not filled until Event:OpenWindow does DO InitializeWindow which does the
first DO RefreshWindow that actually loads them.

For a File Loaded Drop List in Event:OpenWindow you should see a DO Fld#:FillList that loads the Queue. You could search the Embeditor for: ADD(Queue:FileDrop

My recollection of the way that the drop list works is that it first fills the queue, and then it tries to set the selected record to the value that matches the “field to fill” variable defined for the list. If it doesn’t find a match in the queue then it sets to the first record. No time to check right now, but maybe that will point you in the right direction – not having specified a field to fill from/to or chnaging the slect on the list after it has been chosen.