FlexCardView - Advanced Features

This article describes functions that go beyond simple design.


For scripting we added two properties available from inside a card.

property description
CardOffset vertical offset of the card (card number * lines per card)
CardParentControl the parent screen/window control, where the cardview is located

Usage Tips

How do I know from which row the current card gets its content?

The control elements on the card automatically get the correct information.
But what if I need to retrieve some information manually?

Solution 1: use bound controls

Lets assume you have a FlexLabel in the first row, called flexLabel_6_14.
You can now check the ScreenPos of this label.
On the first card, this is probably like the name (6,14). On the second card the ScreenPos may be (8,14).
Attention: Despite of the changed position, the name of the label is still flexLabel_6_14.

Solution 2: use math :slight_smile:

An alternative solution is to use property CardOffset.
When you know that the required information is located at position (x =20, y=10), your postion is

var yPos = 10 + CardOffset;

How can I access screen information not on the current card?

With the property Screen you have access to the whole content of the data stream.

How can I access controls on the main control from a card?

As the main (screen) control and the card are different controls there is no direct access.
But there is still an easy solution for this

Step 1: enhance main control

Add public methods to the main control.
It is strongly recommended to use methods instead of accessing controls directly.

public void SetPropertyFromCard(string value)
    label1.Text = value;

public string GetSpecialValue()
    return flexLabel_1_1.Text;

Step 2: access from inside card

From inside the card you can use the property CardParentControl to access the main screen control. The call the previously created public methods.

private void button2_Click(object sender, System.EventArgs e)
    var mainControl = CardParentControl as FlexControls.Screen_fd79484b6e1a4b659fa62978d2f91424;

You have to cast CardParentControl to the class name of your main screen control.