In article <a84984760910211220v4c3440e1yc86b654ae8010...@mail.gmail.com>,
   John Labenski <jlaben...@gmail.com> wrote:
> On Wed, Oct 21, 2009 at 9:30 AM, Michael Gerbracht <smartma...@arcor.de>
> 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


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to