PDA

View Full Version : Coding sage counsel



Bidmaron
April 17th, 2009, 13:30
I am working on code to implement a disclosure triangle control (where you can click a triangle and the window expands to reveal additional data and click again to hide it). What I am trying to do on the clickrelease event is to compare the window's size in a particular dimension to its original size. I am doing so by Making a window.getSize call and this is going good. When I try to access the original size by referencing window.placement.size.height, however I get a console error saying I am attempting to index the nil field 'size'. I have triple-checked that the window has the fields in the XML, so what am I doing wrong? How could it be okay with window.placement but get confused when I add size to that?

Bidmaron
April 18th, 2009, 04:36
Bump.
I'm afraid my title might have masked that I'm asking for help.

Moon Wizard
April 18th, 2009, 10:27
I don't think that the original size is available by referencing the size field. It may only be used by FG when initializing the control, but not available to scripts. My guess is that you will have to hard-code the small and large values you want to use within your scripts.

Cheers,
JPG

Bidmaron
April 18th, 2009, 13:26
Bummer. A work-around will be to query the size of the parent window in my onInit code and store that somewhere.

joshuha
April 18th, 2009, 13:32
Keep in mind the windowmanager.lua file already spawns on windowopened events to keep track of last x/y position as well as last width/height. You could add parameters in their to also store original w/h when a new window is put into there you could always reference as your baseline.

Bidmaron
April 18th, 2009, 13:41
I don't think I want to override windowmanage.lua in an extension do I? That would open up too many upgrade conflicts. Can you think of anything inherently wrong with my workaround? The getSize call on the parent window should work in the onInit event of a subordinate control, right?