void ScrollViewer::OnKeyDown(suic::KeyEventArg& e) { bool handled = true; if (e.IsPageup()) { PageUp(); } else if (e.IsPagedown()) { PageDown(); } else if (e.IsHomeKey()) { ScrollToHome(); } else if (e.IsEndKey()) { ScrollToEnd(); } else { handled = false; } e.Handled(handled); }
BOOL COXHistoryCtrl::AppendToLine(CString string, BOOL bAddToLog/*=TRUE*/) { //enter into a critical section EnterCriticalSection(&m_criticalSection); if(m_arrEntries.IsEmpty()) return FALSE; //update the log file if(bAddToLog && m_bEnableLog) WriteToLog(string,FALSE); HISTORYENTRY entry=m_arrEntries.GetTail(); entry.m_sText+=string; m_arrEntries.SetAt(m_arrEntries.GetTailPosition(),entry); int nLength=entry.m_sText.GetLength(); if(m_nMaxLengthEntry<nLength) { m_nMaxLengthEntry=nLength; UpdateScrollInfo(); } ScrollToEnd(); RedrawWindow(); //exit the critical section LeaveCriticalSection(&m_criticalSection); return TRUE; }
LRESULT CFulEditCtrl::onSize(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled){ if(isSet(HANDLE_SCROLL)) { if(wParam != SIZE_MINIMIZED && HIWORD(lParam) > 0) ScrollToEnd(); } bHandled = FALSE; return 0; }
BOOL COXHistoryCtrl::AddLine(CString string, BOOL bAddToLog/*=TRUE*/) { //enter into a critical section EnterCriticalSection(&m_criticalSection); //update the log file if(bAddToLog && m_bEnableLog) WriteToLog(string,TRUE); BOOL bUpdateScroll=FALSE; ASSERT(m_arrEntries.GetCount()<=GetMaxNumEntries()); HISTORYENTRY entry(string,m_clrText,m_clrBack,m_nOffset,m_nAlignment); m_arrEntries.AddTail(entry); if(m_arrEntries.GetCount()==GetMaxNumEntries()+1) { entry=m_arrEntries.RemoveHead(); ASSERT(entry.m_sText.GetLength()<=m_nMaxLengthEntry); if(entry.m_sText.GetLength()==m_nMaxLengthEntry) { UpdateMaxLengthInfo(); bUpdateScroll=TRUE; } } else bUpdateScroll=TRUE; int nLength=string.GetLength(); if(m_nMaxLengthEntry<nLength) { m_nMaxLengthEntry=nLength; bUpdateScroll=TRUE; } if(bUpdateScroll) UpdateScrollInfo(); ScrollToEnd(); RedrawWindow(); //exit the critical section LeaveCriticalSection(&m_criticalSection); return TRUE; }
logical OutputArea :: DisplayOutput ( ) { PropertyHandle *out = output_ctx ? output_ctx->GetPropertyHandle() : NULL; logical term = NO; BEGINSEQ if ( !out ) ERROR *out = output; output_ctx->FillControl(); output_ctx->FlushGUI(); ScrollToEnd(); RECOVER term = YES; ENDSEQ return(NO); }
void CHistoryWnd::SetPlayHistory(LPCTSTR szText) { BOOL bUseSuitSymbols = theApp.GetValue(tbUseSuitSymbols); if (bUseSuitSymbols) m_editPlay.LockWindowUpdate(); // m_editPlay.SetWindowText(szText); // if (bUseSuitSymbols) ReplaceSuitSymbols(m_editPlay); // if (m_bShowPlay) { ScrollToEnd(m_editPlay, m_numVisiblePlayRows); if (bUseSuitSymbols) m_editPlay.UnlockWindowUpdate(); m_editPlay.UpdateWindow(); } }
void CHistoryWnd::SetBiddingHistory(LPCTSTR szText) { BOOL bUseSuitSymbols = theApp.GetValue(tbUseSuitSymbols); if (bUseSuitSymbols) m_editBidding.LockWindowUpdate(); // m_editBidding.SetWindowText(szText); // if (bUseSuitSymbols) ReplaceSuitSymbols(m_editBidding); // if (m_bShowBidding) { ScrollToEnd(m_editBidding, m_numVisibleBiddingRows); if (bUseSuitSymbols) m_editBidding.UnlockWindowUpdate(); m_editBidding.UpdateWindow(); } }
bool wxScrollBar::PerformAction(const wxControlAction& action, long numArg, const wxString& strArg) { int thumbOld = m_thumbPos; bool notify = false; // send an event about the change? wxEventType scrollType; // test for thumb move first as these events happen in quick succession if ( action == wxACTION_SCROLL_THUMB_MOVE ) { DoSetThumb(numArg); // VS: we have to force redraw here, otherwise the thumb will lack // behind mouse cursor UpdateThumb(); scrollType = wxEVT_SCROLLWIN_THUMBTRACK; } else if ( action == wxACTION_SCROLL_LINE_UP ) { scrollType = wxEVT_SCROLLWIN_LINEUP; ScrollLines(-1); } else if ( action == wxACTION_SCROLL_LINE_DOWN ) { scrollType = wxEVT_SCROLLWIN_LINEDOWN; ScrollLines(1); } else if ( action == wxACTION_SCROLL_PAGE_UP ) { scrollType = wxEVT_SCROLLWIN_PAGEUP; ScrollPages(-1); } else if ( action == wxACTION_SCROLL_PAGE_DOWN ) { scrollType = wxEVT_SCROLLWIN_PAGEDOWN; ScrollPages(1); } else if ( action == wxACTION_SCROLL_START ) { scrollType = wxEVT_SCROLLWIN_THUMBRELEASE; // anything better? ScrollToStart(); } else if ( action == wxACTION_SCROLL_END ) { scrollType = wxEVT_SCROLLWIN_THUMBRELEASE; // anything better? ScrollToEnd(); } else if ( action == wxACTION_SCROLL_THUMB_DRAG ) { // we won't use it but this line suppresses the compiler // warning about "variable may be used without having been // initialized" scrollType = wxEVT_NULL; } else if ( action == wxACTION_SCROLL_THUMB_RELEASE ) { // always notify about this notify = true; scrollType = wxEVT_SCROLLWIN_THUMBRELEASE; } else return wxControl::PerformAction(action, numArg, strArg); // has scrollbar position changed? bool changed = m_thumbPos != thumbOld; if ( notify || changed ) { if ( IsStandalone() ) { // we should generate EVT_SCROLL events for the standalone // scrollbars and not the EVT_SCROLLWIN ones // // NB: we assume that scrollbar events are sequentially numbered // but this should be ok as other code relies on this as well scrollType += wxEVT_SCROLL_TOP - wxEVT_SCROLLWIN_TOP; wxScrollEvent event(scrollType, this->GetId(), m_thumbPos, IsVertical() ? wxVERTICAL : wxHORIZONTAL); event.SetEventObject(this); GetEventHandler()->ProcessEvent(event); } else // part of the window { wxScrollWinEvent event(scrollType, m_thumbPos, IsVertical() ? wxVERTICAL : wxHORIZONTAL); event.SetEventObject(this); GetParent()->GetEventHandler()->ProcessEvent(event); } } return true; }