www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Problems with the DLangUI TreeWidget

reply pezi_pink <pezi_pink pezipink.com> writes:
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
Sep 08
parent reply Vadim Lopatin <coolreader.org gmail.com> writes:
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.
Sep 08
parent reply pezi_pink <pezi_pink pezipink.com> writes:
On Friday, 8 September 2017 at 15:08:27 UTC, Vadim Lopatin wrote:
 On Friday, 8 September 2017 at 12:10:23 UTC, pezi_pink wrote:
 [...]
It's known issue: https://github.com/buggins/dlangui/issues/278 Not sure if there is any workaround.
Ah, thanks for the reply. I did check the issues on git, obviously not well enough! That's a shame, it renders (no pun intended) DLangUI basically useless for my project :( maybe I will have to get the debugger out ...
Sep 08
next sibling parent Vadim Lopatin <coolreader.org gmail.com> writes:
On Friday, 8 September 2017 at 15:39:21 UTC, pezi_pink wrote:
 On Friday, 8 September 2017 at 15:08:27 UTC, Vadim Lopatin 
 wrote:
 On Friday, 8 September 2017 at 12:10:23 UTC, pezi_pink wrote:
 [...]
It's known issue: https://github.com/buggins/dlangui/issues/278 Not sure if there is any workaround.
Ah, thanks for the reply. I did check the issues on git, obviously not well enough! That's a shame, it renders (no pun intended) DLangUI basically useless for my project :( maybe I will have to get the debugger out ...
Will try to fix it in a few days.
Sep 08
prev sibling parent reply Vadim Lopatin <coolreader.org gmail.com> writes:
On Friday, 8 September 2017 at 15:39:21 UTC, pezi_pink wrote:
 On Friday, 8 September 2017 at 15:08:27 UTC, Vadim Lopatin 
 wrote:
 On Friday, 8 September 2017 at 12:10:23 UTC, pezi_pink wrote:
 [...]
It's known issue: https://github.com/buggins/dlangui/issues/278 Not sure if there is any workaround.
Ah, thanks for the reply. I did check the issues on git, obviously not well enough! That's a shame, it renders (no pun intended) DLangUI basically useless for my project :( maybe I will have to get the debugger out ...
Fixed in v0.9.121 See example1 / TreeWidget for sample of adding / removing of items.
Sep 11
parent reply pezi_pink <pezi_pink pezipink.com> writes:
On Monday, 11 September 2017 at 09:00:36 UTC, Vadim Lopatin wrote:
 On Friday, 8 September 2017 at 15:39:21 UTC, pezi_pink wrote:
 On Friday, 8 September 2017 at 15:08:27 UTC, Vadim Lopatin 
 wrote:
 On Friday, 8 September 2017 at 12:10:23 UTC, pezi_pink wrote:
 [...]
It's known issue: https://github.com/buggins/dlangui/issues/278 Not sure if there is any workaround.
Ah, thanks for the reply. I did check the issues on git, obviously not well enough! That's a shame, it renders (no pun intended) DLangUI basically useless for my project :( maybe I will have to get the debugger out ...
Fixed in v0.9.121 See example1 / TreeWidget for sample of adding / removing of items.
Fantasic! Thank you very much :)
Sep 11
parent Vadim Lopatin <coolreader.org gmail.com> writes:
On Monday, 11 September 2017 at 17:57:14 UTC, pezi_pink wrote:
 On Monday, 11 September 2017 at 09:00:36 UTC, Vadim Lopatin
 Fixed in v0.9.121

 See example1 / TreeWidget for sample of adding / removing of 
 items.
Fantasic! Thank you very much :)
Feel free to submit issues on https://github.com/buggins/dlangui/issues if something is unclear or does not work as expected.
Sep 12