- sbMax = wMain.GetID()->GetScrollRange(wxHORIZONTAL);
- sbThumb = wMain.GetID()->GetScrollThumb(wxHORIZONTAL);
- if ((sbMax != H_SCROLL_MAX) || (sbThumb != H_SCROLL_STEP)) {
- wMain.GetID()->SetScrollbar(wxHORIZONTAL, 0, H_SCROLL_STEP, H_SCROLL_MAX);
- modified = true;
+ if (horizontalScrollBarVisible) {
+ if (stc->m_hScrollBar == NULL) { // Use built-in scrollbar
+ int sbMax = stc->GetScrollRange(wxHORIZONTAL);
+ int sbThumb = stc->GetScrollThumb(wxHORIZONTAL);
+ if ((sbMax != H_SCROLL_MAX) || (sbThumb != H_SCROLL_STEP)) {
+ stc->SetScrollbar(wxHORIZONTAL, 0, H_SCROLL_STEP, H_SCROLL_MAX);
+ modified = true;
+ }
+ }
+ else { // otherwise use the one that's been given to us
+ int sbMax = stc->m_hScrollBar->GetRange();
+ int sbPage = stc->m_hScrollBar->GetPageSize();
+ if ((sbMax != H_SCROLL_MAX) || (sbPage != H_SCROLL_STEP)) {
+ stc->m_hScrollBar->SetScrollbar(0, H_SCROLL_STEP, H_SCROLL_MAX, H_SCROLL_STEP);
+ modified = true;
+ }
+ }