Page 1 of 1

A vertical scroll bar is shown in Single line text control

Posted: Tue Nov 20, 2012 7:25 am
by viveksha
Hi Guys,
I am having a problem while using wxWidgets 2.9.2
I am getting a vertical scroll bar in single line text control for two byte characters on MAC OS.
I have to fix this bug in my project.
So I found the problem which is in wxWidgets-2.9\src\osx\carbon\textctrl.cpp

in this source code we have a function to create a scroll view using which we scroll in text control :


wxMacMLTEHIViewControl::wxMacMLTEHIViewControl( wxTextCtrl *wxPeer,
const wxString& str,
const wxPoint& pos,
const wxSize& size, long style ) : wxMacMLTEControl( wxPeer )
{
m_font = wxPeer->GetFont() ;
m_windowStyle = style ;
Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ;
wxString st = str ;
wxMacConvertNewlines10To13( &st ) ;

HIRect hr = {
{ bounds.left , bounds.top },
{ bounds.right - bounds.left, bounds.bottom - bounds.top } } ;

m_scrollView = NULL ;
TXNFrameOptions frameOptions = FrameOptionsFromWXStyle( style ) ;

if (( frameOptions & (kTXNWantVScrollBarMask | kTXNWantHScrollBarMask)) || (frameOptions &kTXNSingleLineOnlyMask))
{
if ( frameOptions & (kTXNWantVScrollBarMask | kTXNWantHScrollBarMask) )
{
HIScrollViewCreate(
(frameOptions & kTXNWantHScrollBarMask ? kHIScrollViewOptionsHorizScroll : 0)
| (frameOptions & kTXNWantVScrollBarMask ? kHIScrollViewOptionsVertScroll : 0) ,
&m_scrollView ) ;
}
else
{
HIScrollViewCreate(kHIScrollViewOptionsVertScroll,&m_scrollView);
HIScrollViewSetScrollBarAutoHide(m_scrollView,true);
}

HIViewSetFrame( m_scrollView, &hr );
HIViewSetVisible( m_scrollView, true );
}

m_textView = NULL ;
HITextViewCreate( NULL , 0, frameOptions , &m_textView ) ;
m_txn = HITextViewGetTXNObject( m_textView ) ;
HIViewSetVisible( m_textView , true ) ;
if ( m_scrollView )
{
HIViewAddSubview( m_scrollView , m_textView ) ;
m_controlRef = m_scrollView ;
InstallEventHandler( (WXWidget) m_textView ) ;
}
else
{
HIViewSetFrame( m_textView, &hr );
m_controlRef = m_textView ;
}

AdjustCreationAttributes( *wxWHITE , true ) ;
#ifndef __LP64__
wxMacWindowClipper c( GetWXPeer() ) ;
#endif
SetTXNData( st , kTXNStartOffset, kTXNEndOffset ) ;

TXNSetSelection( m_txn, 0, 0 );
TXNShowSelection( m_txn, kTXNShowStart );

::InstallControlEventHandler( m_textView , GetwxMacTextControlEventHandlerUPP(),
GetEventTypeCount(eventList), eventList, this,
NULL);
}


So as you can see in the else part while creating scroll view we are intentionally creating vertical scroll bar and then hiding it.
Somehow this HIScrollViewSetScrollBarAutoHide function does not seem to be wroking and user can still see vertical scroll bar in single line text control.

For fixing this I tried creating Horizontal bar and then tried to Hide it then Somehow the scroll bar is hidden but there came some other problem in the text control so finally I had to remove those changes and now I need some permanent fix for this issue so that it will not break any other text control functionality.
I have attached the screenshot of the problem. Please have a look.

Please help me for this as this is an important fix for me.

Thanks and Regards,
Vivek

Re: A vertical scroll bar is shown in Single line text contr

Posted: Tue Nov 20, 2012 12:03 pm
by doublemax
This is a user forum. First you should try again with wx 2.9.4 or the latest version from SVN. If the problem still exists, please file a bug report here: http://trac.wxwidgets.org/

If possible try to reproduce the problem with a patch to the "minimal" sample or any other sample that comes with wxWidgets.

Re: A vertical scroll bar is shown in Single line text contr

Posted: Tue Nov 20, 2012 12:08 pm
by viveksha
Thanks for the reply .
I have reproduced it with 2.8 also but the problem seems to be same.
On google I have seen few people reproting this problem but for some reason no body goy reply for this.
Since i am new to this forum i did not have idea where to Post it.
I will post a bug on link you mentioned.
Please try to help me because this is causing my project's weekly release.
Regards,
Vivek

Re: A vertical scroll bar is shown in Single line text contr

Posted: Fri Nov 30, 2012 3:41 am
by protocol
Can you resolve it by changing the font (size or family)?

Re: A vertical scroll bar is shown in Single line text contr

Posted: Fri Nov 30, 2012 4:03 am
by viveksha
Hi ,
I tried everything but its not working and for wx Widgets 2.8 the same code is working fine.

Re: A vertical scroll bar is shown in Single line text contr

Posted: Fri Nov 30, 2012 10:06 am
by doublemax
You still haven't provided a sample to reproduce the problem. Neither here nor on the mailing list. Then it's hard to find a solution, because it's obviously related to something else in your code.