Page 1 of 1

Add Property StatusBarText

PostPosted: Thu Aug 12, 2010 10:40 am
by jasantana
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.

Re: Add Property StatusBarText

PostPosted: Thu Aug 12, 2010 10:44 am
by jcompagner
does application.setStatusText() not work for you?

Re: Add Property StatusBarText

PostPosted: Thu Aug 12, 2010 10:46 am
by ROCLASI
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.

Re: Add Property StatusBarText

PostPosted: Fri Aug 13, 2010 11:29 am
by jasantana
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.

Re: Add Property StatusBarText

PostPosted: Fri Aug 13, 2010 11:33 am
by jcompagner
you still only have to do that once, just make a (base) form and attach your method to onElementFocusGained

Re: Add Property StatusBarText

PostPosted: Fri Aug 13, 2010 1:05 pm
by jasantana
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.

Re: Add Property StatusBarText

PostPosted: Fri Aug 13, 2010 2:02 pm
by Joas
jasantana wrote: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 wrote: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".

Re: Add Property StatusBarText

PostPosted: Mon Aug 16, 2010 8:34 am
by Jeroen de Vries
To build generic stuff like this, it would be nice if we could add custom properties and methods to UI objects.

Re: Add Property StatusBarText

PostPosted: Mon Aug 16, 2010 10:22 am
by jcompagner
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?

Re: Add Property StatusBarText

PostPosted: Mon Aug 16, 2010 10:56 am
by Jeroen de Vries
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.

Re: Add Property StatusBarText

PostPosted: Mon Aug 16, 2010 11:18 am
by jcompagner
assign we have, thats ondatachange.

access we also kind of have, thats custom converters.

Re: Add Property StatusBarText

PostPosted: Mon Aug 16, 2010 11:24 am
by Jeroen de Vries
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.

Re: Add Property StatusBarText

PostPosted: Mon Aug 16, 2010 11:48 am
by jasantana
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.