From: Michael G. <sma...@ar...> - 2009-10-22 07:41:15
|
In article <a84...@ma...>, John Labenski <jla...@gm...> wrote: > On Wed, Oct 21, 2009 at 9:30 AM, Michael Gerbracht <sma...@ar...> > wrote: > > Is it possible to change the style of a TreeCtrl once it has been > > created. I want to make it user configurable whether lines are shown or > > not - so is there a was to set/unset wx.wxTR_NO_LINES ? > Unfortunately the styles do not take effect in MSW. You could Destroy() the > control and recreate it if you also store the data as a Lua table. > http://docs.wxwidgets.org/stable/wx_wxtreectrl.html#wxtreectrlsetwindowstyle I store the data in lua anyway so this should not be a problem. Or changes will just apply after a restart. Still I am not sure how to set the style upon creation. I use the following code to create it: local tree = wx.wxTreeCtrl(this, wx.wxID_ANY,wx.wxPoint(0,0), wx.wxSize(160,250),wx.wxTR_DEFAULT_STYLE + wx.wxTR_NO_LINES + wx.wxTR_HIDE_ROOT + wx.wxTR_MULTIPLE + wx.wxNO_BORDER); The styles are separated by a "+" sign, which is not standard lua so I do not know how to make a style optional. I tried to use a variable instead of "wx.wxTR_NO_LINES" and set it to either nil or "wx.wxTR_LINES". Both fail. One possibility might be to define two sets of styles, one including "wx.wxTR_NO_LINES" and the other one not. This works if you only want to make one style configuarable. Is there a better/more flexible way to define the styles? Thanks, Michael |