Hi,

Is it possible to reference another controls property either in the UI XML or in code?

For example, let's say I have a MainFrame with a borderlayout and docked to the north panel I want to include PanelX, how can I set the Height property of the North region to be the height of PanelX?

i.e. I would like to be able to do this sort of thing...

<cell docking="North" height=panelX.height>

or something similar.

Thanks,

Craig.

This question is marked "community wiki".

asked 27 Apr '13, 21:59

Craig's gravatar image

Craig
1.1k141
accept rate: 6%

Hi Craig,

This is not possible but what is it that you are trying to achieve? If you can describe your use case maybe we can show a way.

(28 Apr '13, 05:20) Yalim Gerger ♦♦

Hi Yalim,

A use case would be the example in my question above, i.e. you have a border layout and in one of the regions you want to set the size of a given region to the size of something else.

I built a small application using border layout, I had a grid in the north region, a grid in the center, a gauge in the east and west; when the application opened the north region was so small that it only displayed the header of the grid so I set the height of the north region and this worked but I could not get the height region set correctly easily to match the grid height in the way I wanted.

What I wanted to be able to do always ensure that the north grid only displayed 3 rows at a time and then tell the borderlayout that the north region was the same size as the 3 row grid.

Thanks,

Craig

link

answered 28 Apr '13, 05:52

Craig's gravatar image

Craig
1.1k141
accept rate: 6%

Hi Craig,

In order to ensure that the grid displays 3 rows at a time, you have to calculate and set the height of the cell containing the grid manually.

Then, you can simulate the need of referencing grid panel's width using tableLayout and the heightPolicy attribute of the tableLayout row. When the heightPolicy of a tableLayout row is set as Dynamic, Formspider automatically adjusts the height of the row to fit its content.

In your case, you can implement a wrapper panel simulating a borderLayout as follows:

<panel>
  <tableLayout>
    <row>
      <!--docking West-->
      <cell width="300" hAlign="Full" vAlign="Full"/>
      <!-- docking Center-->
      <cell/>
      <!-- docking East-->
      <cell width="300" hAlign="Full" vAlign="Full"/>
    </row>
    <row/>
    <!-- docking South-->
    <row heightPolicy="Dynamic">
      <cell hAlign="Full" vAlign="Full" columnSpan="3">
        <include panelName="gridPanel"/>
      </cell>
    </row>
  </tableLayout>
</panel>

Then you can use this wrapper panel in your mainFrame:

<mainframe>
  <borderLayout>
    <cell docking="Center">
      <include panelName="wrapper"/>
    </cell>
  </borderLayout>
</mainframe>

But please note that since the Dynamic heightPolicy requires some calculations at the client(JS) part, it's usage should be limited as much as possible since the excess usage of this feature may slow down the application performance.

Hope this helps,
Ibrahim

link

answered 29 Apr '13, 03:38

Ibrahim%20Sandalli's gravatar image

Ibrahim Sand... ♦♦
1.5k5
accept rate: 25%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×12
×6
×3
×1

Asked: 27 Apr '13, 21:59

Seen: 1,383 times

Last updated: 29 Apr '13, 03:38


© Copyright Gerger 2017