Hi all,
Is there a way to override or otherwise change the execution for the property setter functions for a derived widget? For example, I want to execute some Javascript when the height of a menu is changed, but if I add a height key/function to the propertySetters object in my derived widget and then change the height of my menu, the function isn't executed.
I'd like to be able to run some custom code when properties change, even if the event bubbles up to the base widget, without having to re-create the entire menu myself.
Am I missing something, or is this not possible? Thanks.
Override propertySetters of derived widgets
-
- New User
- Posts: 13
- Joined: Mon Apr 04, 2011 10:24 am
- First Name: Ryan
- Last Name: Cook
- Company Name: StoneRiver, Inc
- State / Province: Florida
- Country: United States
- Contact:
- Brian
- Profound Logic Staff Member
- Posts: 286
- Joined: Thu Apr 14, 2011 10:23 am
- First Name: Brian
- Last Name: May
- Company Name: Profound Logic Software
- Contact:
Re: Override propertySetters of derived widgets
Currently, propertySetters are not supported for derived widgets. This is something we can consider, but it is not currently in plan.
I would be curious as to what exactly you are trying to accomplish. Perhaps we can offer an alternative solution.
I would be curious as to what exactly you are trying to accomplish. Perhaps we can offer an alternative solution.
-
- New User
- Posts: 13
- Joined: Mon Apr 04, 2011 10:24 am
- First Name: Ryan
- Last Name: Cook
- Company Name: StoneRiver, Inc
- State / Province: Florida
- Country: United States
- Contact:
Re: Override propertySetters of derived widgets
There are a number of situations where this might be useful, but for example, I have a menu with variable options, and I'd like to have the menu automatically adjust its height depending on how many options are present. In order to do this, I'd like to execute some code when the options property changes, but I'm not sure how without having a propertySetter.
Another example would be to add an email icon to the end of a hyperlink if the value contains an email address. I can do this using Javascript, but there's no way that I know of to tell when the value changes.
My solutions to both of these situations, if propertySetters aren't an option, are to either do the automatic actions when the page loads or create custom widgets that re-implement the functionality of the already existing widgets. The first option doesn't work in the designer, and the second creates extra work that I'd really rather avoid doing.
If you can think of any alternative solutions, please let me know. Thanks.
Another example would be to add an email icon to the end of a hyperlink if the value contains an email address. I can do this using Javascript, but there's no way that I know of to tell when the value changes.
My solutions to both of these situations, if propertySetters aren't an option, are to either do the automatic actions when the page loads or create custom widgets that re-implement the functionality of the already existing widgets. The first option doesn't work in the designer, and the second creates extra work that I'd really rather avoid doing.
If you can think of any alternative solutions, please let me know. Thanks.
- Brian
- Profound Logic Staff Member
- Posts: 286
- Joined: Thu Apr 14, 2011 10:23 am
- First Name: Brian
- Last Name: May
- Company Name: Profound Logic Software
- Contact:
Re: Override propertySetters of derived widgets
Ok, perhaps I can offer some ideas.
With regard to changing the height of your menu. Obviously, you are loading your Choices property in your RPG program since you say it has a variable number of options. You could just as easily bind the Height property to an RPG field and control the height that way. Just figure out how many pixels each menu item takes up and then its simple multiplication.
the same could be done with an email icon after your hyperlink. Since you say it can change, you must be changing it in your program using a bound field. So you can easily bind the Visible property and control it from your RPG.
Is there a reason these methods would not work for you?
With regard to changing the height of your menu. Obviously, you are loading your Choices property in your RPG program since you say it has a variable number of options. You could just as easily bind the Height property to an RPG field and control the height that way. Just figure out how many pixels each menu item takes up and then its simple multiplication.
the same could be done with an email icon after your hyperlink. Since you say it can change, you must be changing it in your program using a bound field. So you can easily bind the Visible property and control it from your RPG.
Is there a reason these methods would not work for you?
-
- New User
- Posts: 13
- Joined: Mon Apr 04, 2011 10:24 am
- First Name: Ryan
- Last Name: Cook
- Company Name: StoneRiver, Inc
- State / Province: Florida
- Country: United States
- Contact:
Re: Override propertySetters of derived widgets
You're right about both.
For the menu, I can bind the height and do the calculation with RPG. I failed to mention earlier though (posting right before lunch does that...) that I have some other fields positioned below the menu whose top positions I'd like to adjust as the height of the menu changes. Since everything is absolutely positioned, I was hoping to be able to traverse through those elements and adjust the top positions (which is simple enough using js/css). I could bind the top positions of all of those fields, but a programmatic solution is more appealing, especially since the menu/fields construct will appear on multiple pages.
For the menu, I can bind the height and do the calculation with RPG. I failed to mention earlier though (posting right before lunch does that...) that I have some other fields positioned below the menu whose top positions I'd like to adjust as the height of the menu changes. Since everything is absolutely positioned, I was hoping to be able to traverse through those elements and adjust the top positions (which is simple enough using js/css). I could bind the top positions of all of those fields, but a programmatic solution is more appealing, especially since the menu/fields construct will appear on multiple pages.
- Brian
- Profound Logic Staff Member
- Posts: 286
- Joined: Thu Apr 14, 2011 10:23 am
- First Name: Brian
- Last Name: May
- Company Name: Profound Logic Software
- Contact:
Re: Override propertySetters of derived widgets
OK, so you have a work around if needed. I'm not saying we can't or won't implement propertySetters for derived widgets, but it is something that will take some internal discussion and planning. I will let you know if we decide to do so.
Who is online
Users browsing this forum: No registered users and 2 guests