A vertical scroll bar is shown in Single line text control

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
viveksha
Earned a small fee
Earned a small fee
Posts: 21
Joined: Tue Nov 20, 2012 7:07 am

A vertical scroll bar is shown in Single line text control

Post 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
Attachments
scrollbars_Seen_in_TextControl_iin_JA.jpg
scrollbars_Seen_in_TextControl_iin_JA.jpg (67.46 KiB) Viewed 2836 times
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

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

Post 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.
Use the source, Luke!
viveksha
Earned a small fee
Earned a small fee
Posts: 21
Joined: Tue Nov 20, 2012 7:07 am

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

Post 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
protocol
Moderator
Moderator
Posts: 680
Joined: Wed Jan 18, 2006 6:13 pm
Location: Dallas, TX
Contact:

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

Post by protocol »

Can you resolve it by changing the font (size or family)?
/* UIKit && wxWidgets 2.8 && Cocoa && .Net */
QuRegExmm
wxPCRE & ObjPCRE - Regex It!
viveksha
Earned a small fee
Earned a small fee
Posts: 21
Joined: Tue Nov 20, 2012 7:07 am

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

Post by viveksha »

Hi ,
I tried everything but its not working and for wx Widgets 2.8 the same code is working fine.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

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

Post 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.
Use the source, Luke!
Post Reply