From: Alex T. <al...@tw...> - 2004-09-26 21:09:26
|
At 12:23 26/09/2004 -0700, Gordon Webster wrote: >Dear Pythoncard BB > >I have created a TextArea control in my app, it >automatically has a vertical scroll bar but the text >is too wide for the control. How do I tell it to >include a horizontal scroll bar? At the moment you can't. wxWidgets doesn't support setting wx.HSCROLL except when the underlying TextCtrl is being created. I've enclosed a version of PythonCard/components/textarea.py - you can (temporarily) replace your copy with this, and then you can use the resourceEditor to set hscroll (to 1 or 0) [ I want to Kevin's ok to this approach before committing it to cvs ] >I still don't understand how i get at the wx level of >a given pythoncard control - what is the hook? >I tried suff like e.g. >self.components.myTextArea.style = wx.HSCROLL. >Any help would be greatly appreciated. There are no >horizontal scrollbars in any of the sample apps. Problem is that style isn't changeable after being created (unless I missed something in wxWidgets docs). Here are the changes (or just use the attached file) >Index: textarea.py >=================================================================== >RCS file: /cvsroot/pythoncard/PythonCard/components/textarea.py,v >retrieving revision 1.27 >diff -c -r1.27 textarea.py >*** textarea.py 25 Sep 2004 03:21:20 -0000 1.27 >--- textarea.py 26 Sep 2004 21:05:35 -0000 >*************** >*** 21,26 **** >--- 21,27 ---- > 'editable' : {'presence' : 'optional', 'default' : 1}, > 'alignment' : {'presence' : 'optional', 'default' : 'left', > 'values' :['left', 'right', 'center']}, > 'border' : {'presence' : 'optional', 'default' : '3d', > 'values' :['3d', 'none']}, >+ 'hscroll' : {'presence' : 'optional', 'default' : 0}, > 'size' : { 'presence' : 'optional', 'default' : [ -1, 50 ] }, > } > widget.WidgetSpec.__init__( self, 'TextArea', 'TextField' , > events, attributes ) >*************** >*** 39,44 **** >--- 40,49 ---- > borderStyle = wx.NO_BORDER > else: > borderStyle = 0 >+ if aResource.hscroll == 1: >+ hScroll = wx.HSCROLL >+ else: >+ hScroll = 0 > > self._alignment = aResource.alignment > >*************** >*** 54,60 **** > ## style = wx.TE_RICH2 | wx.TE_PROCESS_TAB | > wx.TE_MULTILINE | borderStyle | \ > style = wx.TE_RICH2 | wx.TE_MULTILINE | borderStyle | \ > textfield.getAlignment(aResource.alignment) | \ >! wx.NO_FULL_REPAINT_ON_RESIZE | wx.CLIP_SIBLINGS, > name = aResource.name ) > > widget.Widget.__init__(self, aParent, aResource) >--- 59,65 ---- > ## style = wx.TE_RICH2 | wx.TE_PROCESS_TAB | > wx.TE_MULTILINE | borderStyle | \ > style = wx.TE_RICH2 | wx.TE_MULTILINE | borderStyle | \ > textfield.getAlignment(aResource.alignment) | \ >! wx.NO_FULL_REPAINT_ON_RESIZE | wx.CLIP_SIBLINGS | hScroll, > name = aResource.name ) > > widget.Widget.__init__(self, aParent, aResource) -- Alex. |