What do you mean? I run your code and this is the result:

[image: image.png]

  It is bold...

Best,
Scuri


Em qui., 25 de nov. de 2021 às 02:51, Kaz F <kaz.fox...@gmail.com> escreveu:

> I was able to get the following code to work, but is there a way to set
> the “ICONS” branch to display in bold text when the branch is created?
>
>
>
> --CODE------------------------------------------------
>
> require("iuplua")
>
>
>
> local tree = iup.flattree{rastersize="400x500"}
>
>
>
> tree["addbranch-1"] = "ICONS" -- add root node
>
> tree:SetNodeAttributes(0,{titlefontstyle = "Bold"}) --make root node bold.
>
>
>
> local tlist = {
>
>     {
>
>       "Red","Orange","Yellow","Green","Blue","Purple";
>
>       branchname = "COLOR"
>
>     };
>
>     {
>
>       "Ranged","Melee","Summon","Heal";
>
>       branchname = "POWERS"
>
>     };
>
> }
>
> iup.TreeAddNodes(tree, tlist)
>
>
>
> local testdlg = iup.dialog{iup.vbox{tree;ncmargin = "25 x 25"}; title =
> "Test Window"}
>
> testdlg:showxy(iup.CENTER, iup.CENTER)
>
>
>
> if (iup.MainLoopLevel()==0) then
>
>     iup.MainLoop()
>
> end
>
>
>
> *From: *Ola Zetterqvist <o...@zetterqvist.nu>
> *Sent: *Saturday, November 20, 2021 9:58 AM
> *To: *iup-users@lists.sourceforge.net
> *Subject: *Re: [Iup-users] How do you get Flat controls to work in Lua?
>
>
>
> Thanks for the clarification, I needed that.
>
> Best,
>
> Ola Zetterqvist
>
>
>
>
>
> Den 2021-11-20 kl. 14:40, skrev Antonio Scuri:
>
>   One very important difference between IupTree andIpFlatTre is that the
> flat version does not include a default root node. That's why the solution
> proposed by Ola works.
>
>
>
>   Regarding the error in Lua this can be done:
>
>
>
> --tree.ADDBRANCH-1 = "NFL";     -- Error in lua
>
> tree["ADDBRANCH-1"] = "NFL";
>
>
>
> Best,
>
> Scuri
>
>
>
>
>
> Em sáb., 20 de nov. de 2021 às 08:33, Ola Zetterqvist <o...@zetterqvist.nu>
> escreveu:
>
> Hello,
>
> Have found a solution that works.
> Used flattree in C and it has worked,  where "ADDBRANCH-1" is used for the
> first node but lua does not understand the syntax, one must use
>
> iup.SetAttribute(tree, "ADDBRANCH-1", "Lua tree");
>
> require("iuplua")
> tree = iup.flattree{}
>
> local dlg = iup.dialog{tree; size = "200x150",title = "Test Window"}
>
> iup.SetAttribute(tree, "ADDBRANCH-1", "Lua tree");
>
> --tree.ADDBRANCH-1 = "NFL";     -- Error in lua
>
> tree.TITLE ="Test tree"         -- Change "Lua tree" title
> tree.ADDBRANCH0 = "AFC";
> tree.ADDBRANCH1 = "EAST";
> tree.ADDLEAF2 = "Patriots";
> tree.ADDLEAF3 = "Bills";
> tree.ADDLEAF4 = "Jets";
> tree.ADDLEAF5 = "Dolphins";
> tree.INSERTBRANCH2 = "North";
> tree.ADDLEAF7 = "Ravens";
> tree.ADDLEAF8 = "Steelers";
> tree.ADDLEAF9 = "Browns";
> tree.ADDLEAF10 = "Bengals";
>
> dlg:map()
> dlg:showxy(iup.CENTER, iup.CENTER)
>
> if (iup.MainLoopLevel()==0) then
>     iup.MainLoop()
> end
>
>
>
>
>
> Best,
>
> Ola Zetterqvist
>
>
>
>
>
> Den 2021-11-20 kl. 08:24, skrev Kaz F:
>
> Hello,
> I can’t figure out how to get iup.flattree to work and couldn’t find any
> examples in Lua.
> I can get iup.tree to work just fine, but changing it to iup.flattree
> leaves me with an empty square in my dialog.
> Is there an additional “require” that I’m missing?
> Thanks,
> Kaz
>
>
>
> Iup-users mailing list
>
> Iup-users@lists.sourceforge.net
>
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
>
> _______________________________________________
> Iup-users mailing list
> Iup-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to