first time using styled text ctrl...

Jeff Peery jeffpeery at yahoo.com
Sat Jul 1 11:33:35 PDT 2006


hello, I'm for the first time using a styledtxtctrl and I'm not sure  exactly how this works. I read the docs but they don't seem to start  with 'newbie' basics... nevertheless I managed to get some of the  functionality I want. I have a slider bar that I want to slide and as I  slide it a length of 5 characters is highlighted in the styled text  ctrl.... here is basically what I do now:
  
  def OnDataSliderScroll(self, event):
  # set start of highlighted section, use the slider value
  start = self.DataSlider.GetValue()
  end = start + 5
  # select the region in the styled text ctrl
  self.styledTextCtrl1.SetSelection(start,end)
  self.styledTextCtrl1.SetSelBackground(True, wx.RED)
  self.styledTextCtrl1.SetSelForeground(True, wx.WHITE)
  
    

 so this is basically what I want to do, but this won't work  for me because I have two of these sliders and I want to  highlight/select two different regions. I don't think I can select two  different regions with two different background colors. so I just need  to change the style of a group of text as the user slides the slide  bar. I tried something like this but didn't get anywhere:
  
  def OnDataSliderScroll(self, event):
    # create a style that I want to use to highlight a region specified by the slider
    self.styledTextCtrl1.StyleSetSpec(0,'fore:[wx.WHITE],back:[wx.RED]')
    # goto the start of the text that I want to style. the start value depends of the slider value
  start = self.DataSlider.GetValue()
    self.styledTextCtrl1.GotoPos(start)
  # set the style of the 5 characters after the start position, use style '0' that I specified above
    self.styledTextCtrl1.SetStyling(5, 0)
  
     
  What might I be missing here??? thanks again!!
  
  Jeff
Josiah Carlson <jcarlson at uci.edu> wrote:  
Jeff Peery  wrote:
> hello, I was wondering about the functionality of a tree list control.
> what I would like to do is have a tree control and when I select and
> item in it I want to list say 5 items in the list control. if I pick a
> different tree item then I will want to show a different 5 items in the
> list control. what I am finding with the tree list ctrl is that I can
> only display one item the list per item selected from the tree. is this
> correct? maybe what I need is just a tree control and a separate list
> control? 

You are correct, the TreeListCtrl is essentially a tree control for
which there is a single additional item per tree item.  If you want to
display a different list depending on what tree node is selected, you
will indeed have to use a TreeCtrl and a ListCtrl.

 - Josiah



 		
---------------------------------
Do you Yahoo!?
 Get on board. You're invited to try the new Yahoo! Mail Beta.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/20060701/5e967524/attachment.htm


More information about the wxpython-users mailing list