Esempio n. 1
0
/*******************************************************************
*
*       _cbWindow

  The callback moves the edit-fiels when a notification message
  was send.
*/
static void _cbWindow(WM_MESSAGE *pMsg) {
  WM_SCROLL_STATE ScrollState;
  switch (pMsg->MsgId) {
  case WM_NOTIFY_PARENT:
    if (pMsg->Data.v == WM_NOTIFICATION_VALUE_CHANGED) {
      if (WM_GetId(pMsg->hWinSrc) == GUI_ID_HSCROLL) {
        WM_GetScrollState(pMsg->hWinSrc, &ScrollState);
        if (_x != ScrollState.v) {
          int x, y;
          for (y = 0; y < EDIT_MAX_Y; y++) {
            for (x = 0; x < EDIT_MAX_X; x++) {
              WM_MoveWindow(_aahEdit[y][x], _x - ScrollState.v, 0);
            }
          }
          _x = ScrollState.v;
        }
      }
    }
    break;
  case WM_PAINT:
    GUI_SetBkColor(GUI_BLACK);
    GUI_Clear();
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
/*********************************************************************
*
*       _cbCallbackFramewin
*
* Purpose:
*   Handles the scroll messages of the scrollbar
*/
static void _cbCallbackFramewin(WM_MESSAGE * pMsg) {
  WM_HWIN hDlg;
  hDlg = pMsg->hWin;
  switch (pMsg->MsgId) {
    case WM_NOTIFY_PARENT:
      if (pMsg->Data.v == WM_NOTIFICATION_VALUE_CHANGED) {
        if (pMsg->hWinSrc == WM_GetScrollbarH(hDlg)) {
          int xPos, yPos;
          WM_SCROLL_STATE ScrollState;
          WM_GetScrollState(pMsg->hWinSrc, &ScrollState);
          xPos = WM_GetWindowOrgX(WM_GetParent(_hDlg)) - ScrollState.v;
          yPos = WM_GetWindowOrgY(_hDlg);
          WM_MoveTo(_hDlg, xPos, yPos);
        }
      }
      break;
    default:
      WM_DefaultProc(pMsg);
  }
}
/*********************************************************************
*
*       Callback
*/
static void _LISTBOX_Callback (WM_MESSAGE*pMsg) {
  LISTBOX_Handle hObj = pMsg->hWin;
  LISTBOX_Obj* pObj = LISTBOX_H2P(hObj);
  WM_SCROLL_STATE ScrollState;
  /* Let widget handle the standard messages */
  if (WIDGET_HandleActive(hObj, pMsg) == 0) {
    return;
  }
  switch (pMsg->MsgId) {
  case WM_NOTIFY_PARENT:
    if (pMsg->Data.v == WM_NOTIFICATION_VALUE_CHANGED) {
      WM_GetScrollState(pMsg->hWinSrc, &ScrollState);
    }
    pObj->ScrollState.v = ScrollState.v;
    WM_InvalidateWindow(hObj);
    break;
  case WM_ADD_SCROLLBAR:
    _SetScrollState(hObj);
    break;
  case WM_PAINT:
    _Paint(hObj);
    break;
  case WM_TOUCH:
    if (_OnTouch(hObj, pObj, pMsg) == 0)
      return;
    break;
  case WM_KEY:
    if ( ((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt >0) {
      int Key = ((WM_KEY_INFO*)(pMsg->Data.p))->Key;
      switch (Key) {
        case GUI_KEY_TAB:
          break;                    /* Send to parent by not doing anything */
        default:
          LISTBOX_AddKey(hObj, Key);
          return;
      }
    }
    break;
  }
  WM_DefaultProc(pMsg);
}
Esempio n. 4
0
/*********************************************************************
*
*       _LISTVIEW_Callback
*/
static void _LISTVIEW_Callback (WM_MESSAGE *pMsg) {
  LISTVIEW_Handle hObj;
  LISTVIEW_Obj* pObj;
  WM_SCROLL_STATE ScrollState;
  hObj = pMsg->hWin;
  /* Let widget handle the standard messages */
  if (WIDGET_HandleActive(hObj, pMsg) == 0) {
    return;
  }
  pObj = LISTVIEW_H2P(hObj);
  switch (pMsg->MsgId) {
  case WM_NOTIFY_CLIENTCHANGE:
  case WM_SIZE:
    LISTVIEW__UpdateScrollParas(hObj, pObj);
    return;
  case WM_NOTIFY_PARENT:
    switch (pMsg->Data.v) {
    case WM_NOTIFICATION_CHILD_DELETED:
      /* make sure we do not send any messages to the header child once it has been deleted */
      if (pMsg->hWinSrc == pObj->hHeader) {
        pObj->hHeader = 0;
      }
      break;
    case WM_NOTIFICATION_VALUE_CHANGED:
      if (pMsg->hWinSrc == WM_GetScrollbarV(hObj)) {
        WM_GetScrollState(pMsg->hWinSrc, &ScrollState);
        pObj->ScrollStateV.v = ScrollState.v;
        LISTVIEW__InvalidateInsideArea(hObj, pObj);
        _NotifyOwner(hObj, WM_NOTIFICATION_SCROLL_CHANGED);
      } else if (pMsg->hWinSrc == WM_GetScrollbarH(hObj)) {
        WM_GetScrollState(pMsg->hWinSrc, &ScrollState);
        pObj->ScrollStateH.v = ScrollState.v;
        LISTVIEW__UpdateScrollParas(hObj, pObj);
        HEADER_SetScrollPos(pObj->hHeader, pObj->ScrollStateH.v);
        _NotifyOwner(hObj, WM_NOTIFICATION_SCROLL_CHANGED);
      }
      break;
    case WM_NOTIFICATION_SCROLLBAR_ADDED:
      LISTVIEW__UpdateScrollParas(hObj, pObj);
      break;
    }
    return;
  case WM_PAINT:
    _Paint(hObj, pObj, pMsg);
    return;
  case WM_TOUCH:
    _OnTouch(hObj, pObj, pMsg);
    return;        /* Important: message handled ! */
  case WM_KEY:
    if (((const WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt > 0) {
      int Key;
      Key = ((const WM_KEY_INFO*)(pMsg->Data.p))->Key;
      if (_AddKey(hObj, Key)) {
        return;
      }
    }
    break;  /* No return here ... WM_DefaultProc needs to be called */
  case WM_DELETE:
    _FreeAttached(pObj);
    break;  /* No return here ... WM_DefaultProc needs to be called */
  }
  WM_DefaultProc(pMsg);
}
Esempio n. 5
0
static void _cbProtection_FrameWin(WM_MESSAGE * pMsg) 
{
  switch (pMsg->MsgId)
  {
  case WM_NOTIFY_PARENT:
    {
      WM_HWIN hObjSrc = pMsg->hWinSrc;
      int Id = WM_GetId(hObjSrc);
      int NCode = pMsg->Data.v;
      
      switch (NCode)
      {
      case WM_NOTIFICATION_GOT_FOCUS:
        {
          if (focus_Modbus_settings != hObjSrc)
          {
            /*
            Визначаємо координати об'єкта, який сфокусований
            */
            WM_SCROLL_STATE ScrollState;
            WM_GetScrollState(ScrollBar_Modbus, &ScrollState);

            int y_hWinSrc = _y_cbPickup_Modbus + WM_GetWindowOrgY(pMsg->hWinSrc);
            int y_hWin    = WM_GetWindowOrgY(pMsg->hWin);
            int y_tmp = y_hWinSrc - y_hWin;
            int v_scroll;
            v_scroll = y_tmp/ScrollState.PageSize;
            v_scroll *= ScrollState.PageSize;
        
            if (_y_cbPickup_Modbus != v_scroll)
            {
              int dy = _y_cbPickup_Modbus - v_scroll;
              for (unsigned int i = 0; i < MAX_NUMBER_ITEMS_MODBUS; i++) 
              {
                WM_MoveWindow(*(Modbus_t + i), 0, dy);
                WM_MoveWindow(*(Modbus_v + i), 0, dy);
              }
              WM_MoveWindow(Modbus_d, 0, dy);
            }
            _y_cbPickup_Modbus = v_scroll;
            focus_Modbus_settings = hObjSrc;
            SCROLLBAR_SetValue(ScrollBar_Modbus, v_scroll);
          }
          break;
        }
      case WM_NOTIFICATION_VALUE_CHANGED:
        {
          if (
              (Id == ID_MODBUS_ADDRESS_VALUE) ||
              (Id == ID_MODBUS_TIMEOUT_VALUE)
             )   
          {
            float value = EDIT_GetFloatValue(hObjSrc);

            int  min = 0, max = 0, value_int;
            unsigned int changer_was_made = false;
            
            switch (Id)
            {
            case ID_MODBUS_ADDRESS_VALUE:
              {
                min = KOEF_ADDRESS_MIN;
                max = KOEF_ADDRESS_MAX;
                value_int = (int)(value);
                if (
                    (current_ekran.edition != 0) &&
                    (edit_settings_1.RS_comm_addres != value_int)
                   )
                {
                  edit_settings_1.RS_comm_addres = value_int;
                  changer_was_made = true;
                }
                break;
              }
            case ID_MODBUS_TIMEOUT_VALUE:
              {
                min = VALUE_TIME_OUT_1_INTERFACE_MIN;
                max = VALUE_TIME_OUT_1_INTERFACE_MAX;
                value_int = (int)(round(value*10.0f));
                if (
                    (current_ekran.edition != 0) &&
                    (edit_settings_1.chTimeOut_RS != value_int)
                   )
                {
                  edit_settings_1.chTimeOut_RS = value_int;
                  changer_was_made = true;
                }
                break;
              }
              default: break;
            }
            
            if (
                (changer_was_made == true) &&
                (current_ekran.edition == 1)
               )    
            {
              //Помічаємо, що дані змінені
              char title[256];
              title[0] = '\0';
              strcat_mal(title, (char *)Modbus_panel_title.ptitle[sel_language]);
              strcat_mal(title, (char *)MODE.ptitle[sel_language]);
              strcat_mal(title, "*");
              FRAMEWIN_SetText(Modbus_FrameWin, title);
              current_ekran.edition = 2;
            }
            
            __info_data info_data;
            EDIT_GetUserData(hObjSrc, &info_data, sizeof(__info_data));
            if ((info_data.extra_param & FLAG_SIGNED_FATA) != 0) value_int = abs(value_int);
            if ((value_int >= min) && (value_int <= max))
            {
              EDIT_SetTextColor(hObjSrc, EDIT_CI_DISABLED, GUI_BLACK);
              EDIT_SetTextColor(hObjSrc, EDIT_CI_ENABLED, GUI_BLACK);
            }
            else
            {
              EDIT_SetTextColor(hObjSrc, EDIT_CI_DISABLED, GUI_RED);
              EDIT_SetTextColor(hObjSrc, EDIT_CI_ENABLED, GUI_RED);
            }
          }
          
          break;
        }
      }

      break;
    }
//  case WM_PAINT:
//    {
//      
//      break;
//    }
  default:
    {
      WM_DefaultProc(pMsg);
      break;
    }
  }
}
Esempio n. 6
0
/*********************************************************************
*
*       _LISTBOX_Callback
*/
static void _LISTBOX_Callback(WM_MESSAGE*pMsg) {
  LISTBOX_Handle hObj = pMsg->hWin;
  LISTBOX_Obj* pObj = LISTBOX_H2P(hObj);
  WM_SCROLL_STATE ScrollState;
  /* Let widget handle the standard messages */
  if (WIDGET_HandleActive(hObj, pMsg) == 0) {
    /* Owner needs to be informed about focus change */
    if (pMsg->MsgId == WM_SET_FOCUS) {
      if (pMsg->Data.v == 0) {            /* Lost focus ? */
        _NotifyOwner(hObj, LISTBOX_NOTIFICATION_LOST_FOCUS);
      }
    }
    return;
  }
  switch (pMsg->MsgId) {
  case WM_NOTIFY_PARENT:
    switch (pMsg->Data.v) {
    case WM_NOTIFICATION_VALUE_CHANGED:
      if (pMsg->hWinSrc  == WM_GetScrollbarV(hObj)) {
        WM_GetScrollState(pMsg->hWinSrc, &ScrollState);
        pObj->ScrollStateV.v = ScrollState.v;
        LISTBOX__InvalidateInsideArea(hObj);
        _NotifyOwner(hObj, WM_NOTIFICATION_SCROLL_CHANGED);
      } else if (pMsg->hWinSrc == WM_GetScrollbarH(hObj)) {
        WM_GetScrollState(pMsg->hWinSrc, &ScrollState);
        pObj->ScrollStateH.v = ScrollState.v;
        LISTBOX__InvalidateInsideArea(hObj);
        _NotifyOwner(hObj, WM_NOTIFICATION_SCROLL_CHANGED);
      }
      break;
    case WM_NOTIFICATION_SCROLLBAR_ADDED:
      LISTBOX_UpdateScrollers(hObj);
      break;
    }
    break;
  case WM_PAINT:
    _OnPaint(hObj, pObj, pMsg);
    break;
  case WM_PID_STATE_CHANGED:
    {
      const WM_PID_STATE_CHANGED_INFO* pInfo = (const WM_PID_STATE_CHANGED_INFO*)pMsg->Data.p;
      if (pInfo->State) {
        int Sel;
        Sel = _GetItemFromPos(hObj, pObj, pInfo->x, pInfo->y);
        if (Sel >= 0) {
          _ToggleMultiSel(hObj, pObj, Sel);
          LISTBOX_SetSel(hObj, Sel);
        }
        _NotifyOwner(hObj, WM_NOTIFICATION_CLICKED);
        return;
      }
    }
    break;
  case WM_TOUCH:
    _OnTouch(hObj, pMsg);
    return;
#if GUI_SUPPORT_MOUSE
  case WM_MOUSEOVER:
    if (_OnMouseOver(hObj, pObj, pMsg) == 0)
      return;
    break;
#endif
  case WM_DELETE:
    _FreeAttached(pObj);
    break;       /* No return here ... WM_DefaultProc needs to be called */
  case WM_KEY:
    if (((const WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt > 0) {
      int Key;
      Key = ((const WM_KEY_INFO*)(pMsg->Data.p))->Key;
      if (LISTBOX_AddKey(hObj, Key)) {
        return;
      }
    }
    break;
  case WM_SIZE:
    LISTBOX_UpdateScrollers(hObj);
    WM_InvalidateWindow(hObj);
    break;
  }
  WM_DefaultProc(pMsg);
}
Esempio n. 7
0
/*********************************************************************
*
*       LISTVIEW_Callback
*/
void LISTVIEW_Callback (WM_MESSAGE *pMsg) {
  LISTVIEW_Handle hObj;
  LISTVIEW_Obj* pObj;
  WM_SCROLL_STATE ScrollState;
  hObj = pMsg->hWin;
  /* Let widget handle the standard messages */
  if (WIDGET_HandleActive(hObj, pMsg) == 0) {
    return;
  }
  pObj = (LISTVIEW_Obj *)GUI_ALLOC_h2p(hObj); /* Don't use use WIDGET_H2P because WIDGET_INIT_ID() has not be called at this point */
  switch (pMsg->MsgId) {
  case WM_NOTIFY_CLIENTCHANGE:
  case WM_SIZE:
    if (pMsg->hWinSrc && (pMsg->hWinSrc == pObj->hHeader)) {
      LISTVIEW__UpdateScrollParas(hObj, pObj);
    }
    return;
  case WM_NOTIFY_PARENT:
    switch (pMsg->Data.v) {
    case WM_NOTIFICATION_CHILD_DELETED:
      /* make sure we do not send any messages to the header child once it has been deleted */
      if (pMsg->hWinSrc == pObj->hHeader) {
        pObj->hHeader = 0;
      }
      break;
    case WM_NOTIFICATION_VALUE_CHANGED:
      if (pMsg->hWinSrc == WM_GetScrollbarV(hObj)) {
        WM_GetScrollState(pMsg->hWinSrc, &ScrollState);
        pObj->ScrollStateV.v = ScrollState.v;
        LISTVIEW__InvalidateInsideArea(hObj, pObj);
        _NotifyOwner(hObj, WM_NOTIFICATION_SCROLL_CHANGED);
      } else if (pMsg->hWinSrc == WM_GetScrollbarH(hObj)) {
        WM_GetScrollState(pMsg->hWinSrc, &ScrollState);
        pObj->ScrollStateH.v = ScrollState.v;
        LISTVIEW__UpdateScrollParas(hObj, pObj);
        HEADER_SetScrollPos(pObj->hHeader, pObj->ScrollStateH.v);
        _NotifyOwner(hObj, WM_NOTIFICATION_SCROLL_CHANGED);
      }
      break;
    case WM_NOTIFICATION_SCROLLBAR_ADDED:
      #if WIDGET_USE_PARENT_EFFECT
        WIDGET_SetEffect(pMsg->hWinSrc, pObj->Widget.pEffect);
      #endif
      LISTVIEW__UpdateScrollParas(hObj, pObj);
      break;
    case WM_NOTIFICATION_RELEASED:
      if ((pMsg->hWinSrc == pObj->hHeader) && (pObj->hSort)) {
        int Column;
        LISTVIEW_SORT * pSort;
        LISTVIEW_COLUMN * pColumn;
        WM_SetFocus(hObj);
        Column = HEADER_GetSel(pObj->hHeader);
        if (Column >= 0) {
          pColumn = (LISTVIEW_COLUMN *)GUI_ARRAY_GetpItem(&pObj->ColumnArray, Column);
          if (pColumn->fpCompare) {
            pSort = (LISTVIEW_SORT *)GUI_ALLOC_h2p(pObj->hSort);
            if (pSort) {
              // ReverseSort
              if (pObj->SortIndex == Column) {
                pSort->Reverse   ^= 1;
                pObj->ReverseSort = 1;
                pObj->IsSorted    = 0;
              } else {
                pSort->Reverse    = 0;
                pObj->SortIndex   = Column;
                pObj->IsPresorted = 0;
              }
              /*
              if (pObj->SortIndex == Column) {
                pSort->Reverse ^= 1;
              } else {
                pSort->Reverse = 0;
                pObj->SortIndex = Column;
              }
              pObj->IsPresorted = 0;
              */
              LISTVIEW__InvalidateInsideArea(hObj, pObj);
            }
          }
        }
      }
      break;
    }
    return;
  case WM_PAINT:
    _Paint(hObj, pObj, pMsg);
    return;
  case WM_TOUCH:
    _OnTouch(hObj, pObj, pMsg);
    return;        /* Important: message handled ! */
  case WM_KEY:
    if (((const WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt > 0) {
      int Key;
      Key = ((const WM_KEY_INFO*)(pMsg->Data.p))->Key;
      if (_AddKey(hObj, pObj, Key)) {
        return;
      }
    }
    break;  /* No return here ... WM_DefaultProc needs to be called */
  case WM_DELETE:
    _FreeAttached(pObj);
    break;  /* No return here ... WM_DefaultProc needs to be called */
  }
  WM_DefaultProc(pMsg);
}
/*********************************************************************
*
*       MainTask
*/
void MainTask(void) {
  WM_HWIN hScrollbar, hDlgOptions;
  GUI_RECT RectDlg, RectClient;
  int Cnt = 0, IndexEffect = 0, ButtonState = 0, DropdownState = 0;
  int ProgbarValue   = 0, ProgbarInc   = 1;
  int SliderValue    = 0, SliderInc    = 1;
  int ScrollbarValue = 0, ScrollbarInc = 1;
  int ListViewInc  = 1;
  int ListBoxInc   = 1;
  int MultiEditInc = 1;
  int Vz = 1;
  const WIDGET_EFFECT * _apEffect[] = {&WIDGET_Effect_3D,     /* Array of effects */
                                      &WIDGET_Effect_Simple, 
                                      &WIDGET_Effect_None};
  const char * _apEffects[] = {"Widget effect: 3D", "Widget effect: Simple", "Widget effect: None"};
  GUI_Init();
  GUI_CURSOR_Show();
  WM_SetCallback(WM_HBKWIN, _cbBkWindow);
  WM_SetCreateFlags(WM_CF_MEMDEV);  /* Use memory devices on all windows to avoid flicker */
  WM_EnableMemdev(WM_HBKWIN);       /* Enable use of memory devices for desktop windows */
  /* Create framewindow and set its properties */
  _hFrameWin = FRAMEWIN_CreateEx(0, 0, 640, 480, 0, WM_CF_SHOW, 0, 0, "", &_cbCallbackFramewin);
  FRAMEWIN_SetMoveable(_hFrameWin, 1);
  FRAMEWIN_SetText(_hFrameWin, _apEffects[0]);
  FRAMEWIN_SetFont(_hFrameWin, &GUI_Font13B_ASCII);
  /* Create main dialog window as child from framewindows client window */
  _hDlg = GUI_CreateDialogBox(_aDlgWidgets,
                              GUI_COUNTOF(_aDlgWidgets), 
                              &_cbCallbackWidgets, 
                              WM_GetClientWindow(_hFrameWin), 0, 0);
  /* Attach scrollbar to framewindows client window and set its properties */
  hScrollbar = SCROLLBAR_CreateAttached(WM_GetClientWindow(_hFrameWin), 0);
  WM_GetWindowRectEx(_hDlg, &RectDlg);
  WM_GetClientRectEx(WM_GetClientWindow(_hFrameWin), &RectClient);
  SCROLLBAR_SetNumItems(hScrollbar, RectDlg.x1);
  SCROLLBAR_SetPageSize(hScrollbar, RectClient.x1);
  /* Create options dialog with 'stay on top' and 'moveable' attribute */
  hDlgOptions = GUI_CreateDialogBox(_aDlgOptions, 
                                    GUI_COUNTOF(_aDlgOptions), 
                                    &_cbCallbackOptions, 
                                    WM_HBKWIN, 0, 0);
  FRAMEWIN_SetMoveable(hDlgOptions, 1);
  WM_SetStayOnTop(hDlgOptions, 1);
  /* Main loop for modifying the widgets */
  while (1) {
    if (_AutoMode) {
      Cnt++;
      /* Modify progbar */
      if ((Cnt % 2) == 0) {
        ProgbarValue += ProgbarInc;
        if ((ProgbarValue == 110) || (ProgbarValue == -10)) {
          ProgbarInc *= -1;
        }
        PROGBAR_SetValue(_ahWin[PROGBAR0], ProgbarValue);
      }
      /* Modify slider */
      if ((Cnt % 2) == 0) {
        int j;
        SliderValue += SliderInc;
        if ((SliderValue == 100) || (SliderValue == 0)) {
          SliderInc *= -1;
        }
        for (j = 0; j < 3; j++) {
          SLIDER_SetValue(_ahWin[SLIDER0 + j], SliderValue);
        }
      }
      /* Modify scrollbar */
      if ((Cnt % 3) == 0) {
        int j;
        ScrollbarValue += ScrollbarInc;
        if ((ScrollbarValue == 90) || (ScrollbarValue == 0)) {
          ScrollbarInc *= -1;
        }
        for (j = 0; j < 3; j++) {
          SCROLLBAR_SetValue(_ahWin[SCROLLBAR0 + j], ScrollbarValue);
        }
      }
      /* Modify multipage */
      if ((Cnt % 120) == 0) {
        MULTIPAGE_SelectPage(_ahWin[MULTIPAGE0], MULTIPAGE_GetSelection(_ahWin[MULTIPAGE0]) ^ 1);
      }
      /* Modify dropdown */
      if ((Cnt % 120) == 0) {
        DropdownState ^= 1;
        if (DropdownState) {
          DROPDOWN_Expand(_ahWin[DROPDOWN0]);
        } else {
          DROPDOWN_Collapse(_ahWin[DROPDOWN0]);
        }
      }
      /* Modify button */
      if ((Cnt % 40) == 0) {
        ButtonState ^= 1;
        BUTTON_SetPressed(_ahWin[BUTTON0], ButtonState);
      }
      /* Modify listbox */
      if ((Cnt % 30) == 0) {
        int Sel;
        Sel = LISTBOX_GetSel(_ahWin[LISTBOX0]);
        if (Sel < 0) {
          Sel = 0;
        }
        LISTBOX_SetSel(_ahWin[LISTBOX0], Sel + ListBoxInc);
        Sel = LISTBOX_GetSel(_ahWin[LISTBOX0]);
        if ((Sel == (int)LISTBOX_GetNumItems(_ahWin[LISTBOX0]) - 1) || (Sel == 0)) {
          ListBoxInc *= -1;
        }
      }
      /* Modify listview */
      if ((Cnt % 50) == 0) {
        int Sel;
        Sel = LISTVIEW_GetSel(_ahWin[LISTVIEW0]);
        if (Sel < 0) {
          Sel = 0;
        }
        LISTVIEW_SetSel(_ahWin[LISTVIEW0], Sel + ListViewInc);
        Sel = LISTVIEW_GetSel(_ahWin[LISTVIEW0]);
        if ((Sel == (int)LISTVIEW_GetNumRows(_ahWin[LISTVIEW0]) - 1) || (Sel == 0)) {
          ListViewInc *= -1;
        }
      }
      /* Modify multiedit */
      if ((Cnt % 5) == 0) {
        int Sel, Len;
        char acBuffer[100];
        MULTIEDIT_SetCursorOffset(_ahWin[MULTIEDIT0], MULTIEDIT_GetCursorCharPos(_ahWin[MULTIEDIT0]) + MultiEditInc);
        MULTIEDIT_GetText(_ahWin[MULTIEDIT0], acBuffer, sizeof(acBuffer));
        Sel = MULTIEDIT_GetCursorCharPos(_ahWin[MULTIEDIT0]);
        Len = strlen(acBuffer);
        if ((Sel == (Len - 1)) || (Sel == 0)) {
          MultiEditInc *= -1;
        }
        if (!DropdownState) {
          WM_SetFocus(_ahWin[MULTIEDIT0]);
        }
      }
      /* Modify graph */
      _AddValues(_ahWin[GRAPH0], 95);
      /* Move window */
      if ((Cnt % 1200) == 0) {
        int Inc;
        WM_HWIN hScroll;
        WM_SCROLL_STATE ScrollState;
        hScroll = WM_GetScrollbarH(WM_GetClientWindow(_hFrameWin));
        WM_GetScrollState(hScroll, &ScrollState);
        Inc = (ScrollState.NumItems - ScrollState.PageSize) / 2;
        ScrollState.v += Inc * Vz;
        if ((ScrollState.v >= Inc * 2) || (ScrollState.v <= 0)) {
          Vz *= -1;
        }
        SCROLLBAR_SetValue(hScroll, ScrollState.v);
      }
      /* Change effect */
      if ((Cnt % 400) == 0) {
        int Index;
        WM_HWIN hWin;
        IndexEffect++;
        Index = IndexEffect % GUI_COUNTOF(_apEffect);
        _SetEffect(Index);
        hWin = WM_GetDialogItem(hDlgOptions, GUI_ID_RADIO0);
        RADIO_SetValue(hWin, Index);
      }
    }
    /* Wait a while */
    GUI_Delay(10);
  }
}