Problems with the DLangUI TreeWidget

Vadim Lopatin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Sep 8 08:08:27 PDT 2017


On Friday, 8 September 2017 at 12:10:23 UTC, pezi_pink wrote:
> I am having some seemingly basic problems using the TreeWidget 
> from DLangUI on Windows.  I posted on the project's gitter 
> channel some time ago but did not get any response.
>
> All I am trying to do is add children to the tree's nodes at 
> runtime.  The simple code below attempts to add a new node when 
> a button is pressed.  As far as I can tell, the node does 
> indeed get added, since the new node responds to keyboard 
> events, but it does not render.  I have tried everything to get 
> it to render, using all the available invalidate/redraw 
> methods, even as far as removing and re-adding the control 
> again to its layout, but nothing seems to work.  Any advice 
> would be greatly received!
>
> extern (C) int UIAppMain(string[] args) {
>   auto window  = Platform.instance.createWindow("DlangUI 
> example - HelloWorld", null);
>   auto vlayout = new VerticalLayout();
>   TreeWidget tree = new TreeWidget("Root");
>   TreeItem tree2 = tree.items.newChild("machinesroot", 
> "Machines"d, null);
>   auto machine0 = tree2.newChild("machine0", "Machine 0"d, 
> null);
>   machine0.newChild("machine0stack", "Stack", null);
>   auto btn = (new Button("btn1", "Button 1"d));
>   btn.click = delegate(Widget src) {
>     // this gets added but does not render
>     tree2.newChild("machine1", "Machine 1"d, null);
>     return true;
>   };
>   vlayout.addChild(btn);
>   vlayout.addChild(tree);
>   window.mainWidget = vlayout;
>   window.show();
>   return Platform.instance.enterMessageLoop();
> }
>
> Thanks

It's known issue:

https://github.com/buggins/dlangui/issues/278

Not sure if there is any workaround.



More information about the Digitalmars-d-learn mailing list