UFO:Alien Invasion
Development => Coding => Topic started by: H-Hour on December 24, 2011, 03:56:03 pm
-
A window node has the ability to set closebutton and dragbutton, which automatically places nodes for closing and dragging the window.
I would like to keep the dragbutton option but use my own custom node for closebutton. However, because the dragbutton is added after the UI script is read, it "covers up" my closebutton, so I can't place my own clickable node over the drag area.
Is there any way to add a node on top of another node that is added automatically? Or, alternatively, is there a way I can create a a custom node that will have the drag functionality?
The attached image shows the default closebutton. If I remove the closebutton from the window and then add a node in roughly the same place with the same functionality, it doesn't work because the dragbutton area covers it up.
-
Use this before you place your close button on top of it.
controls drag {
tooltip "_LMB:Drag/RMB:Close"
pos "x y"
size "x y"
OnRClick { cmd "ui_pop;" }
}
-
Here I used this technique to extend the drag controls over the whole window for inventory and physdata:
http://ufoai.git.sourceforge.net/git/gitweb.cgi?p=ufoai/ufoai;a=blobdiff;f=base/ufos/ui/inventory.ufo;h=64fd86e6e82fd3a8a5cf3114637e81c703eb7244;hp=e8238c00d5c20a4eb38ac8a8f18d804c6bbdf45e;hb=e595912a131da704fc4a82d41d12b90a847f6ad1;hpb=a9ce63d36594871ceede5f704d8fde1245dca341
http://ufoai.git.sourceforge.net/git/gitweb.cgi?p=ufoai/ufoai;a=blobdiff;f=base/ufos/ui/physdat.ufo;h=a20ee92a0c7ef1fd02e658647bffa89e587816d4;hp=e8782c24842b02e3a2fd471f500caeaff1fa7b91;hb=a9ce63d36594871ceede5f704d8fde1245dca341;hpb=2a3e6cc5063fe834b69fc1f0d650420fa74f3826
& the exit button for those windows is on top of the drag controls or in the script code below of them.
-
As MCR found out, you can't change the layout but you can use a custom drag node (controls).
-geever
-
thanks guys, will try it
-
Worked perfectly, thanks. But the wiki says the node type is going to be removed... (http://ufoai.ninex.info/wiki/index.php/UI_node_behaviours/2.4-dev#controls)
-
Actually the window node creates a controls subnode dynamically, so it won't disappear without notice.
-geever
-
The problem is it can became a mess to recode everytime you need a movable window with this layout. I think there is some easy way to code "window" node customization with scripts. But the full system still need fixe (padding-top with influencies into child node, which IMO will broke everything) to be better.