Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
- Earned a small fee
- Posts: 21
- Joined: Tue Nov 20, 2012 7:07 am
I am using wx Widgets 2.9.2 on MACOS with c++ I was working on some scrolling issue and found one piece of code which I just want to understand .
The path is wxWidgets-2.9\src\osx\carbon\textctrl.cpp we are basically trying to implement scrolling in Text Control :
Code: Select all
if (( frameOptions & (kTXNWantVScrollBarMask | kTXNWantHScrollBarMask)) (frameOptions &kTXNSingleLineOnlyMask))
if ( frameOptions & (kTXNWantVScrollBarMask | kTXNWantHScrollBarMask) )
(frameOptions & kTXNWantHScrollBarMask ? kHIScrollViewOptionsHorizScroll : 0)
| (frameOptions & kTXNWantVScrollBarMask ? kHIScrollViewOptionsVertScroll : 0) ,
&m_scrollView ) ;
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 ) ;
HIViewSetFrame( m_textView, &hr );
m_controlRef = m_textView ;
So as you can see in the first else block we are dealing the situation when it is a single line text control and we neither have kTXNWantHScrollBarMask nor kTXNWantVScrollBarMask set i.e. we dont want any scroll bar in the control so what we are doing we are intentionally creating a vertical scroll bar and then hiding it.
So this thing is working fine but still I want to know that if any body has any other way of implement scrolling in single line text control instead of creating a vertical scroll bar intentionally and hiding it.
Thanks and Regards,
Last edited by DavidHart
on Thu Jan 24, 2013 11:02 am, edited 1 time in total.
Reason: Moderator: Added code-tags
- Ultimate wxWidgets Guru
- Posts: 698
- Joined: Mon Apr 30, 2012 11:07 pm
1) Don't ask the same question in 3 different places of the same forum.
2) This is not a forum for developing wx itself, but for how using it.
3) Although wx develpers can make mistakes, like anyone else, they write good code, they think hard about it, they test it. And many users use it, so most bugs arise soon, and are fixed. Does this code expose a bug in your opinion? Can you do it better? If yes, please write a patch and send it to wx developers http://trac.wxwidgets.org/wiki/HowToSubmitPatches
4) A way to understand why the code is done so is that you try to write it on your own, and compare.
- Site Admin
- Posts: 6695
- Joined: Thu Sep 28, 2006 12:23 am
Please note that you are looking at the carbon port of wx, which is going to be discontinued since apple themselves are phasing out carbon. So I wouldn't spend too much time analysing that part of the code; wxOSX/Cocoa is the future
"Keyboard not detected. Press F1 to continue"