In article <a84984760911180806s64a2db84v97cf34dd1d0df...@mail.gmail.com>,
   John Labenski <jlaben...@gmail.com> wrote:
> On Wed, Nov 18, 2009 at 8:29 AM, Michael Gerbracht <smartma...@arcor.de>
> wrote:
> > I am just trying to work with files in the xrc format. I did manage to
> > create a dialog, load it and display it. This works fine now. My problem
> > is that the dialog contains a wxChoice and I need to set the choice items
> > dynamically. Is there a way to do this?

> You should have a handle to the wxPanel or the dialog parent of the
> wxChoice and then you can use wxWindow::FindWindow(int id) to get the
> wxChoice as a wxWindow. Once you get the window you can use
> wxObject::DynamicCast("wxChoice") to turn the wxWindow into a wxChoice.

> http://docs.wxwidgets.org/stable/wx_wxwindow.html#wxwindowfindwindow

> local win = xrcPanel:FindWindow(unique_integer_id_of_the_wxchoice) 
> local choice = win:DynamicCast("wxChoice")
> choice:Insert("Hello", 0)

Thank you very much, I got it to work in the first attempt. Before I was
looking for wxChoice::Insert in the documentation but now I realised that
these commands are listed for wxControlWithItems and are valid for many
classes.

Thanks!
Michael


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to