Exemplo n.º 1
0
void InitDialog
  (
  HWND  hwnd
  )

  {
  Loop*     pLoop           = (Loop*)GetWindowLong(hwnd, DWL_USER);
  char      szBuffer[256];
  long      lGetKey         = AOBJ_GETFIRSTKEY;
  OBJECTID  oi;
  long      index;
  
  // set the dialog title
  AObjGetName(pLoop->ObjectID(), szBuffer, 256);
  SetWindowText(hwnd, szBuffer);

  // fill the values
  wsprintf(szBuffer, "%li", pLoop->StartValue());
  SetDlgItemText(hwnd, ED_START, szBuffer);
  wsprintf(szBuffer, "%li", pLoop->Length());
  SetDlgItemText(hwnd, ED_LENGTH, szBuffer);
  
  // check the radio buttons
  CheckDlgButton(hwnd, RB_TIGHT, !pLoop->MultiTask());
  CheckDlgButton(hwnd, RB_MULTITASK, pLoop->MultiTask());

  // empty the connection combo box
  SendDlgItemMessage(hwnd, CB_CONNECT, CB_RESETCONTENT, 0, 0L);

  // add the "(None)" string
  index = SendDlgItemMessage(hwnd, CB_CONNECT, CB_INSERTSTRING, 0, (long)"(None)");
  SendDlgItemMessage(hwnd, CB_CONNECT, CB_SETITEMDATA, (WPARAM)index, 0L);

  if(pLoop->ConnectionObject() == NULL)
    SendDlgItemMessage(hwnd, CB_CONNECT, CB_SETCURSEL, (WPARAM)index, 0L); 

  // add all number objects to the combobox
  while((oi=AObjGetNextObject(OTYPE_NUMBER, &lGetKey)) != NULL)
    {
    AObjGetName(oi, szBuffer, 256);
    index = SendDlgItemMessage(hwnd, CB_CONNECT, CB_ADDSTRING, 0, (long)szBuffer);
    SendDlgItemMessage(hwnd, CB_CONNECT, CB_SETITEMDATA, (WPARAM)index, (LPARAM)oi);

    // select the item if it is the current connection
    if(pLoop->ConnectionObject() == oi)
      SendDlgItemMessage(hwnd, CB_CONNECT, CB_SETCURSEL, (WPARAM)index, 0L); 
    }
  }