PDA

View Full Version : No vertical anchor defined for [...]



BadElvis
June 15th, 2010, 11:56
Hi,

I have this snippet of code that is supposed to open a window when FG starts (for testing purposes):


function onInit()
...
local w = Interface.openWindow("charlistW", "my_window");
w.setPosition(50,50);
w.setSize(100,150);
local s = w.createControl("stringcontrol", "my_text");
s.setStaticBounds(20, 20, 60, 20);
s.setFont("mini_name");
s.setFrame("mini_name");
end

This results in an error: Ruleset Error: No vertical anchor defined for 'my_text'. This is weird, since the position of the control should be sufficiently defined by setStaticBounds.

What am I missing here? How can i get rid of this error? The stringcontrol shows up correctly in my_window.

Moon Wizard
June 18th, 2010, 20:07
The problem is that the static bounds is set after the control is created. You need to define default anchors in the template "charlistW".

Cheers,
JPG

BadElvis
June 22nd, 2010, 08:37
Hey, thanks for your help. That clarifies things for me!

Cheers, BadElvis