HorizontalSplitPanel function getSplitPosition returns always 50

I would like to store the split position of a HorizontalSplitPanel but the function getSplitPosition always returns 50.

Is there any suggestion what I’m doing wrong?