Hide a field onShow

Hello,

I have this problem since I started to work with Servoy, but never figure how to fixed it, so now I thought to ask about. It wasn’t to urgent so I let it at the end.

OK, let’s say in a form, I have a field that I want to hide due to some settings. I check those setting in onShow method, I see that I need to hide the field and I set the visible state to false. In general I do this:

function onShow() {
    elements.my_field.visible = (globals.mySetting == true);
}

When I start the client and I go in my menu to show that form, for a short moment, that field is visible, but then it disappears. Why the field is first visible and then immediately disappears, when actually it should be hidden from the start and not displayed at all? Or how can this be avoided? Is the onShow the good place to do it? I tried to put it in onLoad, but some data might not be loaded there and it didn’t work.

Thanks,
Bogdan.

If you are using Servoy 6, you can set it’s visibility property in the property panel to be initially invisible. Otherwise, try moving your code to the onLoad. The onLoad occurs before the onShow event.