示例#1
0
文件: main.cpp 项目: idispatch/tvtest
void TPuzzleView::moveTile(TPoint p) {
    p = makeLocal(p);

    /* SS: little change */
    int i;
    for (i = 0; i <= 15; i++)
//    for(int i = 0; i <= 15; i++)
        if (board[i / 4][i % 4] == ' ')
            break;
    int x = p.x / 3;
    int y = p.y;

    switch ((y * 4 + x - i)) {
    case -4: //  Piece moves down
        moveKey (kbDown);
        break;

    case -1: //  Piece moves right
        moveKey (kbRight);
        break;

    case 1: //  Piece moves left
        moveKey (kbLeft);
        break;

    case 4: //  Piece moves up
        moveKey (kbUp);
        break;

    }
    drawView();
}
void TCalendarView::handleEvent(TEvent& event) {
   TPoint point;

   TView::handleEvent(event);
   if (state && sfSelected) {
      if ((event.what&evMouse) && (evMouseDown||evMouseAuto)) {
         point = makeLocal(event.mouse.where);
         if (point.x == 18 && point.y == 0) {
            month++;
            if (month>12) { year++; month=1; }
            drawView();
         } else 
         if (point.x == 20 && point.y == 0) {
            month--;
            if (month<1) { year--; month=12; }
            drawView();
         }
      } else 
      if (event.what == evKeyboard) {
         if ((loByte(event.keyDown.keyCode) == '+') ||
            event.keyDown.keyCode==kbDown)
         {
            month++;
            if (month>12) { year++; month=1; }
         } else 
         if ((loByte(event.keyDown.keyCode) == '-') ||
            event.keyDown.keyCode==kbUp)
         {
            month--;
            if (month<1) { year--; month=12; }
         }
         drawView();
      }
   }
}
示例#3
0
size_t TEditor::getMousePtr( TPoint m )
{
    TPoint mouse = makeLocal( m );
    mouse.x = max(0, min(mouse.x, size.x - 1));
    mouse.y = max(0, min(mouse.y, size.y - 1));
    return charPtr(lineMove(drawPtr, mouse.y + delta.y - drawLine),
        mouse.x + delta.x);
}
int TInputLine::mousePos( TEvent& event )
{
    TPoint mouse = makeLocal( event.mouse.where );
    mouse.x = max( mouse.x, 1 );
    int pos = mouse.x + firstPos - 1;
    pos = max( pos, 0 );
    pos = min( pos, strlen(data) );
    return pos;
}
示例#5
0
QDBusMessage QDBusMessagePrivate::makeLocalReply(const QDBusConnectionPrivate &conn,
                                                 const QDBusMessage &callMsg)
{
    // simulate the reply (return or error) message being sent to the bus and
    // then received back.
    if (callMsg.d_ptr->localReply)
        return makeLocal(conn, *callMsg.d_ptr->localReply);
    return QDBusMessage();      // failed
}
void TMenuView::trackMouse( TEvent& e )
{
    TPoint mouse = makeLocal( e.mouse.where );
    for( current = menu->items; current != 0; current = current->next )
        {
        TRect r = getItemRect( current );
        if( r.contains(mouse) )
            return;
        }
}
示例#7
0
 void Resolver::makeParamSlot(gc<Pattern> param)
 {
   VariablePattern* variable = param->asVariablePattern();
   if (variable != NULL && *variable->name() != "_")
   {
     // It's a variable, so create a named local for it and resolve the
     // variable.
     variable->setResolved(makeLocal(param->pos(), variable->name()));
     
     // Note that we do *not* resolve the variable's inner pattern here. We
     // do that after all param slots are resolved so that we can ensure the
     // param slots are contiguous.
   }
   else
   {
     // We don't have a variable for this parameter, but the argument
     // will still be on the stack, so make an unnamed slot for it.
     makeLocal(param->pos(), String::format("(%d)", unnamedSlotId_++));
   }
 }
int TInputLine::mouseDelta( TEvent& event )
{
    TPoint mouse = makeLocal( event.mouse.where );

    if( mouse.x <= 0 )
        return -1;
    else
        if( mouse.x >= size.x - 1 )
            return 1;
        else
            return 0;
}
void TStatusLine::handleEvent( TEvent& event )
{
    TView::handleEvent(event);

    switch (event.what)
        {
        case  evMouseDown:
            {
            TStatusItem *T = 0;

            do  {
                TPoint mouse = makeLocal( event.mouse.where );
                if( T != itemMouseIsIn(mouse) )
                    drawSelect( T = itemMouseIsIn(mouse) );
                } while( mouseEvent( event, evMouseMove ) );

            if( T != 0 && commandEnabled(T->command) )
                {
                event.what = evCommand;
                event.message.command = T->command;
                event.message.infoPtr = 0;
                putEvent(event);
                }
            clearEvent(event);
            drawView();
            break;
            }
        case evKeyDown:
            {
            for( TStatusItem *T = items; T != 0; T = T->next )
                {
                if( event.keyDown.keyCode ==  T->keyCode && 
                    commandEnabled(T->command))
                    {
                    event.what = evCommand;
                    event.message.command = T->command;
                    event.message.infoPtr = 0;
                    return;
                    }
            }
            break;
            }
        case evBroadcast:
            if( event.message.command == cmCommandSetChanged )
                drawView();
            break;
        }
}
示例#10
0
文件: main.cpp 项目: idispatch/tvtest
void TTable::handleEvent(TEvent& event) {
    TView::handleEvent(event);

    if (event.what == evMouseDown) {
        do {
            if (mouseInView(event.mouse.where)) {
                TPoint spot = makeLocal(event.mouse.where);
                setCursor(spot.x, spot.y);
                charFocused();
            }
        } while (mouseEvent(event, evMouseMove));
        clearEvent(event);
    } else {
        if (event.what == evKeyboard) {
            switch (event.keyDown.keyCode) {
            case kbHome:
                setCursor(0, 0);
                break;
            case kbEnd:
                setCursor(size.x - 1, size.y - 1);
                break;
            case kbUp:
                if (cursor.y > 0)
                    setCursor(cursor.x, cursor.y - 1);
                break;
            case kbDown:
                if (cursor.y < size.y - 1)
                    setCursor(cursor.x, cursor.y + 1);
                break;
            case kbLeft:
                if (cursor.x > 0)
                    setCursor(cursor.x - 1, cursor.y);
                break;
            case kbRight:
                if (cursor.x < size.x - 1)
                    setCursor(cursor.x + 1, cursor.y);
                break;
            default:
                setCursor(event.keyDown.charScan.charCode % 32,
                        event.keyDown.charScan.charCode / 32);
                break;
            }
            charFocused();
            clearEvent(event);
        }
    }
}
示例#11
0
void TListViewer::handleEvent(TEvent &event) {
   TPoint mouse;
   ushort colWidth;
   int oldItem, newItem;
   int count;
   int mouseAutosToSkip = 4;

   TView::handleEvent(event);

   if (event.what == evMouseDown) {
      colWidth = size.x / numCols + 1;
      oldItem =  focused;
      mouse = makeLocal(event.mouse.where);
      if (mouseInView(event.mouse.where))
         newItem = mouse.y + (size.y * (mouse.x / colWidth)) + topItem;
      else
         newItem = oldItem;
      count = 0;
      do  {
         if (newItem != oldItem) {
            focusItemNum(newItem);
            drawView();
         }
         oldItem = newItem;
         mouse = makeLocal(event.mouse.where);
         if (mouseInView(event.mouse.where))
            newItem = mouse.y + (size.y * (mouse.x / colWidth)) + topItem;
         else {
            if (numCols == 1) {
               if (event.what == evMouseAuto)
                  count++;
               if (count == mouseAutosToSkip) {
                  count = 0;
                  if (mouse.y < 0)
                     newItem = focused - 1;
                  else if (mouse.y >= size.y)
                     newItem = focused + 1;
               }
            } else {
               if (event.what == evMouseAuto)
                  count++;
               if (count == mouseAutosToSkip) {
                  count = 0;
                  if (mouse.x < 0)
                     newItem = focused - size.y;
                  else if (mouse.x >= size.x)
                     newItem = focused + size.y;
                  else if (mouse.y < 0)
                     newItem = focused - focused % size.y;
                  else if (mouse.y > size.y)
                     newItem = focused - focused % size.y + size.y - 1;
               }
            }
         }
         if (event.mouse.eventFlags & meDoubleClick)
            break;
      } while (mouseEvent(event, evMouseMove | evMouseAuto));
      focusItemNum(newItem);
      drawView();
      if ((event.mouse.eventFlags & meDoubleClick) && range > newItem)
         selectItem(newItem);
      clearEvent(event);
   } else if (event.what == evKeyDown) {
      if (event.keyDown.charScan.charCode ==  ' ' && focused < range) {
         selectItem(focused);
         newItem = focused;
      } else {
         switch (ctrlToArrow(event.keyDown.keyCode)) {
            case kbUp:
               newItem = focused - 1;
               break;
            case kbDown:
               newItem = focused + 1;
               break;
            case kbRight:
               if (numCols > 1)
                  newItem = focused + size.y;
               else
                  return;
               break;
            case kbLeft:
               if (numCols > 1)
                  newItem = focused - size.y;
               else
                  return;
               break;
            case kbPgDn:
               newItem = focused + size.y * numCols;
               break;
            case  kbPgUp:
               newItem = focused - size.y * numCols;
               break;
            case kbHome:
               newItem = topItem;
               break;
            case kbEnd:
               newItem = topItem + (size.y * numCols) - 1;
               break;
            case kbCtrlPgDn:
               newItem = range - 1;
               break;
            case kbCtrlPgUp:
               newItem = 0;
               break;
            default:
               return;
         }
      }
      focusItemNum(newItem);
      drawView();
      clearEvent(event);
   } else if (event.what == evBroadcast) {
      if ((options & ofSelectable) != 0) {
         if (event.message.command == cmScrollBarClicked &&
            (event.message.infoPtr == hScrollBar ||
               event.message.infoPtr == vScrollBar))
                  focus();        // BUG FIX                  <<------ Change
         else 
         if (event.message.command == cmScrollBarChanged) {
            if (vScrollBar == event.message.infoPtr) {
               focusItemNum(vScrollBar->value);
               drawView();
            } else if (hScrollBar == event.message.infoPtr)
               drawView();
         }
      }
   }
}
示例#12
0
void TButton::handleEvent( TEvent& event )
{
    TPoint mouse;
    TRect clickRect;

    clickRect = getExtent();
    clickRect.a.x++;
    clickRect.b.x--;
    clickRect.b.y--;

    if( event.what == evMouseDown )
        {
        mouse = makeLocal( event.mouse.where );
        if( !clickRect.contains(mouse) )
            clearEvent( event );
        }
    TView::handleEvent(event);

    switch( event.what )
        {
        case evMouseDown:
            clickRect.b.x++;
            Boolean down = False;
            do  {
                mouse = makeLocal( event.mouse.where );
                if( down != clickRect.contains( mouse ) )
                    {
                    down = Boolean( !down );
                    drawState( down );
                    }
                } while( mouseEvent( event, evMouseMove ) );
            if( down )
                {
                press();
                drawState( False );
                }
            clearEvent( event );
            break;

        case evKeyDown:
            char c = hotKey( title );
            if( event.keyDown.keyCode == getAltCode(c) ||
                ( owner->phase == phPostProcess &&
                  c != 0 &&
                  toupper(event.keyDown.charScan.charCode) == c
                ) ||
                ( (state & sfFocused) != 0 &&
                  event.keyDown.charScan.charCode == ' '
                )
              )
                {
                press();
                clearEvent( event );
                }
            break;

        case evBroadcast:
            switch( event.message.command )
                {
                case cmDefault:
                    if( amDefault )
                        {
                        press();
                        clearEvent(event);
                        }
                    break;

                case cmGrabDefault:
                case cmReleaseDefault:
                    if( (flags & bfDefault) != 0 )
                        {
                        amDefault = Boolean(event.message.command == cmReleaseDefault);
                        drawView();
                        }
                    break;

                case cmCommandSetChanged:
                    setState(sfDisabled,Boolean(!commandEnabled(command)));
                    drawView();
                    break;
                }
        break;
        }
}
示例#13
0
void TColorSelector::handleEvent(TEvent &event) {
   const int width = 4;

   TView::handleEvent(event);

   uchar oldColor = color;
   int maxCol = (selType == csBackground) ? 7 : 15;
   switch (event.what) {

   case evMouseDown:
      do  {
         if (mouseInView(event.mouse.where)) {
            TPoint mouse = makeLocal(event.mouse.where);
            color = mouse.y * 4 + mouse.x / 3;
         } else
            color = oldColor;
         colorChanged();
         drawView();
      } while (mouseEvent(event, evMouseMove));
      break;

   case evKeyDown:
      switch (ctrlToArrow(event.keyDown.keyCode)) {
      case kbLeft:
         if (color > 0)
            color--;
         else
            color = maxCol;
         break;

      case kbRight:
         if (color < maxCol)
            color++;
         else
            color = 0;
         break;

      case kbUp:
         if (color > width - 1)
            color -= width;
         else if (color == 0)
            color = maxCol;
         else
            color += maxCol - width;
         break;

      case kbDown:
         if (color < maxCol - (width - 1))
            color += width;
         else if (color == maxCol)
            color = 0;
         else
            color -= maxCol - width;
         break;

      default:
         return;
      }
      break;

   case evBroadcast:
      if (event.message.command == cmColorSet) {
         if (selType == csBackground)
            color = event.message.infoByte >> 4;
         else
            color = event.message.infoByte & 0x0F;
         drawView();
         return ;
      } else
         return;
示例#14
0
void TCluster::handleEvent(TEvent &event) {
   TView::handleEvent(event);
   if (!(options & ofSelectable))
      return;
   if (event.what == evMouseDown) {
      TPoint mouse = makeLocal(event.mouse.where);
      int i = findSel(mouse);
      if ((i != -1) && buttonState(i))
         sel = i;
      drawView();
      do  {
         mouse = makeLocal(event.mouse.where);
         if ((findSel(mouse) == sel) && buttonState(sel))
            showCursor();
         else
            hideCursor();
      } while (mouseEvent(event, evMouseMove));
      showCursor();
      mouse = makeLocal(event.mouse.where);
      if (findSel(mouse) == sel) {
         press(sel);
         drawView();
      }
      clearEvent(event);
   } else if (event.what == evKeyDown) {
      int s = sel;
      switch (ctrlToArrow(event.keyDown.keyCode)) {
      case kbUp:
         if ((state & sfFocused) != 0) {
            int i = 0;
            do {
               i++; s--;
               if (s < 0)
                  s = strings->getCount() - 1;
            } while (!(buttonState(s) || (i > strings->getCount())));
            moveSel(i, s);
            clearEvent(event);
         }
         break;

      case kbDown:
         if ((state & sfFocused) != 0) {
            int i = 0;
            do {
               i++; s++;
               if (s >= strings->getCount())
                  s = 0;
            } while (!(buttonState(s) || (i > strings->getCount())));
            moveSel(i, s);
            clearEvent(event);
         }
         break;
      case kbRight:
         if ((state & sfFocused) != 0) {
            int i = 0;
            do {
               i++; s += size.y;
               if (s >= strings->getCount()) {   // BUG FIX - EFW - 10/25/94
                  s = (s +  1) % size.y;
                  if (s >= strings->getCount())
                     s =  0;
               }
            } while (!(buttonState(s) || (i > strings->getCount())));

            moveSel(i, s);    // BUG FIX - EFW - 10/25/94

            clearEvent(event);
         }
         break;
      case kbLeft:
         if ((state & sfFocused) != 0) {
            int i = 0;
            do {
               i++;
               if (s > 0) {
                  s -= size.y;
                  if (s < 0) {
                     s = ((strings->getCount() + size.y - 1) /
                          size.y) * size.y + s - 1;
                     if (s >= strings->getCount())
                        s = strings->getCount() - 1;
                  }
               } else
                  s = strings->getCount() - 1;

            } while (!(buttonState(s) || (i > strings->getCount())));

            moveSel(i, s);    // BUG FIX - EFW - 10/25/94
            clearEvent(event);
         }
         break;
      default:
         for (int i = 0; i < strings->getCount(); i++) {
            char c = hotKey((char *)(strings->at(i)));
            if (getAltCode(c) == event.keyDown.keyCode ||
                  ((owner->phase == phPostProcess ||
                    (state & sfFocused) != 0
                   ) &&
                   c != 0 &&
                   toupper(event.keyDown.charScan.charCode) == c
                  )
               ) {
               if (buttonState(i)) {
                  if (focus()) {
                     sel = i;
                     movedTo(sel);
                     press(sel);
                     drawView();
                  }
                  clearEvent(event);
               }
               return;
            }
         }
         if (event.keyDown.charScan.charCode == ' ' &&
               (state & sfFocused) != 0
            ) {
            press(sel);
            drawView();
            clearEvent(event);
         }
      }
   }
}
示例#15
0
void TOutlineViewer::handleEvent(TEvent &event) {
   const int mouseAutoToSkip = 3;

   TPoint mouse;
   TNode *cur;
   int newFocus;
   int count;
   char *graph;
   uchar dragged;

   TScroller::handleEvent(event);
   switch (event.what) {
   case evMouseDown:
      count = 0;
      dragged = 0;
      do {
         if (dragged < 2)
            dragged++;
         mouse = makeLocal(event.mouse.where);
         if (mouseInView(event.mouse.where))
            newFocus = delta.y + mouse.y;
         else {
            if (event.what == evMouseAuto)
               count++;
            if (count == mouseAutoToSkip) {
               count = 0;
               if (mouse.y < 0)
                  newFocus--;
               if (mouse.y >= size.y)
                  newFocus++;
            }
         }
         if (foc != newFocus) {
            adjustFocus(newFocus);
            drawView();
         }
      } while (!(event.mouse.eventFlags & meDoubleClick) &&
               mouseEvent(event, evMouseMove + evMouseAuto));

      if (event.mouse.eventFlags & meDoubleClick)
         selected(foc);
      else {
         if (dragged < 2) {
            cur = firstThat(isFocused);
            graph = getGraph(focLevel, focLines, focFlags);
            if (mouse.x < strlen(graph)) {
               adjust(cur, ! isExpanded(cur) ? True : False);
               update();
               drawView();
            }
            delete graph;
         }
      }

      break;

   case evKeyboard:

      newFocus = foc;
      switch (ctrlToArrow(event.keyDown.keyCode)) {
      case kbUp:
      case kbLeft:
         newFocus--;
         break;
      case kbDown:
      case kbRight:
         newFocus++;
         break;
      case kbPgDn:
         newFocus += size.y - 1;
         break;
      case kbPgUp:
         newFocus -= size.y - 1;
         break;
      case kbHome:
         newFocus = delta.y;
         break;
      case kbEnd:
         newFocus = delta.y + size.y - 1;
         break;
      case kbCtrlPgUp:
         newFocus = 0;
         break;
      case kbCtrlPgDn:
         newFocus = limit.y - 1;
         break;
      case kbCtrlEnter:
      case kbEnter:
         selected(newFocus);
         break;
      default:
         uchar code = event.keyDown.charScan.charCode;
         switch (code) {
         case '-':
         case '+':
            adjust(getNode(newFocus), code == '+' ? True : False);
            break;
         case '*':
            expandAll(getNode(newFocus));
            break;
         default:
            return;
         }
         update();
      }
      clearEvent(event);
      adjustFocus(newFocus);
      drawView();
   };
};
示例#16
0
void TEditor::handleEvent( TEvent& event )
{
    TView::handleEvent( event );
    convertEvent( event );
    Boolean centerCursor = Boolean(!cursorVisible());
    uchar selectMode = 0;

    if( selecting == True || (getShiftState() & 0x03) != 0 )
        selectMode = smExtend;

    switch( event.what )
        {

        case evMouseDown:
            if( event.mouse.doubleClick == True )
                selectMode |= smDouble;

            do  {
                lock();
                if( event.what == evMouseAuto )
                    {
                    TPoint mouse = makeLocal( event.mouse.where );
                    TPoint d = delta;
                    if( mouse.x < 0 )
                        d.x--;
                    if( mouse.x >= size.x )
                        d.x++;
                    if( mouse.y < 0 )
                        d.y--;
                    if( mouse.y >= size.y )
                        d.y++;
                    scrollTo(d.x, d.y);
                    }
                setCurPtr(getMousePtr(event.mouse.where), selectMode);
                selectMode |= smExtend;
                unlock();
                } while( mouseEvent(event, evMouseMove + evMouseAuto) );
            break;

        case evKeyDown:
            if( event.keyDown.charScan.charCode == 9 ||
                ( event.keyDown.charScan.charCode >= 32 && event.keyDown.charScan.charCode < 255 ) )
                    {
                    lock();
                    if( overwrite == True && hasSelection() == False )
                        if( curPtr != lineEnd(curPtr) )
                            selEnd = nextChar(curPtr);
                    insertText( &event.keyDown.charScan.charCode, 1, False);
                    trackCursor(centerCursor);
                    unlock();
                    }
            else
                return;
            break;

        case evCommand:
            switch( event.message.command )
                {
                case cmFind:
                    find();
                    break;
                case cmReplace:
                    replace();
                    break;
                case cmSearchAgain:
                    doSearchReplace();
                    break;
                default:
                    lock();
                    switch( event.message.command )
                        {
                        case cmCut:
                            clipCut();
                            break;
                        case cmCopy:
                            clipCopy();
                            // hideSelect(); // JS 12.4.94
                            break;
                        case cmPaste:
                            clipPaste();
                            break;
                        case cmUndo:
                            undo();
                            break;
                        case cmClear:
                            deleteSelect();
                            break;
                        case cmCharLeft:
                            setCurPtr(prevChar(curPtr), selectMode);
                            break;
                        case cmCharRight:
                            setCurPtr(nextChar(curPtr), selectMode);
                            break;
                        case cmWordLeft:
                            setCurPtr(prevWord(curPtr), selectMode);
                            break;
                        case cmWordRight:
                            setCurPtr(nextWord(curPtr), selectMode);
                            break;
                        case cmLineStart:
                            setCurPtr(lineStart(curPtr), selectMode);
                            break;
                        case cmLineEnd:
                            setCurPtr(lineEnd(curPtr), selectMode);
                            break;
                        case cmLineUp:
                            setCurPtr(lineMove(curPtr, -1), selectMode);
                            break;
                        case cmLineDown:
                            setCurPtr(lineMove(curPtr, 1), selectMode);
                            break;
                        case cmPageUp:
                            setCurPtr(lineMove(curPtr, -(size.y-1)), selectMode);
                            break;
                        case cmPageDown:
                            setCurPtr(lineMove(curPtr, size.y-1), selectMode);
                            break;
                        case cmTextStart:
                            setCurPtr(0, selectMode);
                            break;
                        case cmTextEnd:
                            setCurPtr(bufLen, selectMode);
                            break;
                        case cmNewLine:
                            newLine();
                            break;
                        case cmBackSpace:
                            deleteRange(prevChar(curPtr), curPtr, True);
                            break;
                        case cmDelChar:
                            deleteRange(curPtr, nextChar(curPtr), True);
                            break;
                        case cmDelWord:
                            deleteRange(curPtr, nextWord(curPtr), False);
                            break;
                        case cmDelStart:
                            deleteRange(lineStart(curPtr), curPtr, False);
                            break;
                        case cmDelEnd:
                            deleteRange(curPtr, lineEnd(curPtr), False);
                            break;
                        case cmDelLine:
                            deleteRange(lineStart(curPtr), nextLine(curPtr), False);
                            break;
                        case cmInsMode:
                            toggleInsMode();
                            break;
                        case cmStartSelect:
                            startSelect();
                            break;
                        case cmHideSelect:
                            hideSelect();
                            break;
                        case cmIndentMode:
                            autoIndent = Boolean(!autoIndent);
                            break;
                        default:
                            unlock();
                            return;
                        }
                    trackCursor(centerCursor);
                    unlock();
                    break;
                }

        case evBroadcast:
            switch( event.message.command )
                {
                case cmScrollBarChanged:
                    checkScrollBar( event, hScrollBar, delta.x );
                    checkScrollBar( event, vScrollBar, delta.y );
                    break;
                default:
                    return;
                }
        }
    clearEvent(event);
}
示例#17
0
DateTime::DateTime()
{
    Timestamp now;
    m_utcTime = now.utcTime();
    makeLocal(tzd());
}
示例#18
0
DateTime::DateTime(const Timestamp& timestamp)
    : m_utcTime(timestamp.utcTime())
{
    makeLocal(tzd());
}
void TCluster::handleEvent( TEvent& event )
{
    TView::handleEvent(event);
    if( event.what == evMouseDown )
        {
        TPoint mouse = makeLocal( event.mouse.where );
        int i = findSel(mouse);
        if( i != -1 )
            sel = i;
        drawView();
        do  {
            mouse = makeLocal( event.mouse.where );
            if( findSel(mouse) == sel )
                showCursor();
            else
                hideCursor();
            } while( mouseEvent(event,evMouseMove) );
        showCursor();
        mouse = makeLocal( event.mouse.where );
        if( findSel(mouse) == sel )
            {
            press(sel);
            drawView();
            }
        clearEvent(event);
        }
    else if( event.what == evKeyDown )
        switch (ctrlToArrow(event.keyDown.keyCode))
            {
            case kbUp:
                if( (state & sfFocused) != 0 )
                    {
                    if( --sel < 0 )
                        sel = strings->getCount()-1;
                    movedTo(sel);
                    drawView();
                    clearEvent(event);
                    }
                break;

            case kbDown:
                if( (state & sfFocused) != 0 )
                    {
                    if( ++sel >= strings->getCount() )
                        sel = 0;
                    movedTo(sel);
                    drawView();
                    clearEvent(event);
                    }
                break;
            case kbRight:
                if( (state & sfFocused) != 0 )
                    {
                    sel += size.y;
                    if( sel >= strings->getCount() )
                        {
                        sel = (sel +  1) % size.y;
                        if( sel >= strings->getCount() )
                            sel =  0;
                        }
                    movedTo(sel);
                    drawView();
                    clearEvent(event);
                    }
                break;
            case kbLeft:
                if( (state & sfFocused) != 0 )
                    {
                    if( sel > 0 )
                        {
                        sel -= size.y;
                        if( sel < 0 )
                            {
                            sel = ((strings->getCount()+size.y-1) /size.y)*size.y + sel - 1;
                            if( sel >= strings->getCount() )
                                sel = strings->getCount()-1;
                            }
                        }
                    else
                        sel = strings->getCount()-1;
                    movedTo(sel);
                    drawView();
                    clearEvent(event);
                    }
                break;
            default:
                for( int i = 0; i < strings->getCount(); i++ )
                    {
                    char c = hotKey( (char *)(strings->at(i)) );
                    if( getAltCode(c) == event.keyDown.keyCode ||
                        ( ( owner->phase == phPostProcess ||
                            (state & sfFocused) != 0
                          ) &&
                          c != 0 &&
                          toupper(event.keyDown.charScan.charCode) == c
                        )
                      )
                        {
                        select();
                        sel =  i;
                        movedTo(sel);
                        press(sel);
                        drawView();
                        clearEvent(event);
                        return;
                        }
                    }
                if( event.keyDown.charScan.charCode == ' ' &&
                    (state & sfFocused) != 0
                  )
                    {
                    press(sel);
                    drawView();
                    clearEvent(event);
                    }
            }
}