PDA

View Full Version : Coding HElp Please



dulux-oz
March 6th, 2014, 09:29
Hi Guys,

I'm trying to move the top edge of a frame down 35 pixels when I click on a given tab. Relevant Code as follows:

In Main Sheet


<sheetdata>
<sub_record_header name="header">
<class>header</class>
</sub_record_header>
<frame_record name="contentframe">
<anchored>
<top parent="header" anchor="bottom" offset="15" />
<left offset="30" />
<right offset="-45" />
<bottom offset="-65" />
</anchored>
<frame offset="20,17,24,17" />
</frame_record>
<subwindow_record name="sub1">
<class>main</class>
</subwindow_record>
<subwindow_record name="sub2">
<class>alternate</class>
</subwindow_record>
</sheetdata>


In Sheet sub2


<sheetdata>
<frame_record name="contentframe" mergerule="resetandadd">
<frame offset="55,17,24,17" />
</frame_record>
</sheetdata>


But, obviously, its not working - the original frame is still displayed. I've tried mergerule="add" and mergerule="replace" but its still not working.

Any help GREATELY appreciated.

Cheers

Trenloe
March 6th, 2014, 11:38
As an FYI - the merge rules work from a top level template or windowclass and happen during loading, not at runtime. So if you try to change the XML using the merge rules it will change the XML for all uses of that template or windowclass.

However, having said that, the first problem here is that that sub2's <sheetdata> is not the same <sheetdata> as the top level window. sub2 is a subwindow within the top level window. So, trying to us merge rules in this case will just create an additional <frame_record> within the subwindow.

The second problem here is that <frame_record> is defined once within the top level window - if you did make any changes to this they will be seen across all tabs.

So, if you want a different layout on each tab, you're going to have to reduce what is seen at the top level and add that removed code to each subwindow, allowing you to change the offset as required in each subwindow.

dulux-oz
March 6th, 2014, 11:42
Yeap - that's what I was beginning to suspect - damn!

Of well, back to the old drawing-board - thanks Trenloe