Add Property StatusBarText

Good morning from Gran Canaria.

Maybe this can be done somehow I do not know, but I would like to show a text in the StatusBar when an element gets the focus. Maybe a property for the elements, for example StatusBarText, could do it.

When the element gets the focus and that property is not empty it could be shown.

Thanks in advance.

does application.setStatusText() not work for you?

You can use the onFocusGained event on the elements to trigger a method that sets the statustext (application.setStatusText() ).
And of course the onFocusLost event to clear it again.

That way works but I think that is faster if Servoy could do that automatically. :lol: Think about a form with 50 elements.

Could be like the ToolTip. Servoy traps OnMouseOver and OnMouseLeave to show the ToolTip, the same way Servoy could trap onFocusGained and onFocusLost, check if statusBarText property is empty or not and act.

Don´t you think it´s easier for Rapid Development?

Thanks.

you still only have to do that once, just make a (base) form and attach your method to onElementFocusGained

Hi Johan.

Please be patient with me I´m a newbie.

I understand what you mean with placing code in OnElementFocusGained, but where can I store the string to show in the status bar for each element?

What I do not understand is “create a base form”, what is a base form? Do you mean a form that I can subclass? If so how can I do that?

Thanks in advance.

jasantana:
where can I store the string to show in the status bar for each element?

A database would be a good place to store that, create a table that stores the form name, element name and status text.

jasantana:
What I do not understand is “create a base form”, what is a base form? Do you mean a form that I can subclass? If so how can I do that?

A form can inherit stuff from another form. In order to do that you have to set the extendsForm property to that “base form”.

To build generic stuff like this, it would be nice if we could add custom properties and methods to UI objects.

properties i could see some use cases. (to give the elements some extra (configuration) properties that you can ask for)
But what would methods really do?

Sorry for my sparse info.

With methods I really meant access and assign methods.
The access method should fire when a property value is accessed, the assign method should fire when a property is assigned a new value.

With such methods you could simply implement custom validation, that´s their primary use.

assign we have, thats ondatachange.

access we also kind of have, thats custom converters.

What I meant is a method that fires when the value of a custom property changes. So it is like onDataChange per property, you need to be able to add a pair of methods per custom property.

Example: If I would add myProprty to an object I would expect myProperty_Assign and myProperty_Access methods to be added automatically.

Add custom methods to elements is also a good idea if we could subclass elements. With Visual FoxPro you can subclass a base element (for example a textbox) this way you can create an element with code that can be used many times in your app without having to rewrite the code, much more if you need to make a change you can simply modify the class code that will be propagated.