newbie question - scripting events

Use this board to ask questions or have discussions with other Rich Displays users.
leatherlips
Profound User
Posts: 83
Joined: Sun Oct 03, 2010 8:45 am
First Name: Mike
Last Name: Geldert
Company Name: Stonriver
Country: Angola
Contact:

newbie question - scripting events

Post by leatherlips »

I'm attempting to use a menu widget in an existing rich display file. Currently the DDS conversion presented a panel with a dozen "FKEY" buttons. I was going to change the butons' visibility to False, and instead use a menu widget. I wanted the menu widget to "click" the appropriate button when a menu option was pressed.
>>>
onoptionclick
Initiates a client-side script when a menu option is clicked. The choice value is passed to the event as a parameter named "value". The choice text is passed to the event as a parameter named "text".
<<<

I tried a few different things in the event "onoptionclick" for the menu, but nothing has worked for me (yet). (I thought perhaps putting "pui.click(value);" would work, but I'm obviously not correct.)
Hany
New User
Posts: 19
Joined: Fri Jan 04, 2008 12:13 pm
First Name: Hany
Last Name: Elemary
Company Name: Profound Logic Software
Contact:

Re: newbie question - scripting events

Post by Hany »

You had the right idea about the "pui.click" API. What you're missing here is the id of the button that you want clicked when a user clicks on a specific menu option. The value that gets passed from the menu option may not match the id of the button in this case.

What you want is to match the "choice values" property of menu widget to the ids of the button you want clicked and then pass "value" to pui.click(value).

This should do it for you.

Let me know if you need further help.
leatherlips
Profound User
Posts: 83
Joined: Sun Oct 03, 2010 8:45 am
First Name: Mike
Last Name: Geldert
Company Name: Stonriver
Country: Angola
Contact:

Re: newbie question - scripting events

Post by leatherlips »

Thanks for the quick reply!
I did try that, and it didn't work.

So, I then simply put an "alert" in that event, to see if it's firing. It doesn't seem to fire at all no matter what I do.

The onclick and ondblclick both work (used the same "alert" in those), but this onoptionclick didn't. I tried this in a new separate program/file as well. Being a newbie, I'm not sure if there's a way to see the event fire (I tried to see if firebug should anything, but couldn't see an activity at all when pressing an option).

Any ideas on how I can debug this?

Thanks!
Hany
New User
Posts: 19
Joined: Fri Jan 04, 2008 12:13 pm
First Name: Hany
Last Name: Elemary
Company Name: Profound Logic Software
Contact:

Re: newbie question - scripting events

Post by Hany »

I just put together a quick test on our system and things seem to function properly. I suggest having a quick GoToMeeting/phone call to get this resolved.

If you can email me at support@profoundlogic.com with a phone number/time (timezone) to reach you at, I'll give you a call right away and get you all fixed up.

Thanks,

Hany
leatherlips
Profound User
Posts: 83
Joined: Sun Oct 03, 2010 8:45 am
First Name: Mike
Last Name: Geldert
Company Name: Stonriver
Country: Angola
Contact:

Re: newbie question - scripting events

Post by leatherlips »

Thanks for quickly working with me on this. I'm glad we found that I wasn't as dense as I thought!
leatherlips
Profound User
Posts: 83
Joined: Sun Oct 03, 2010 8:45 am
First Name: Mike
Last Name: Geldert
Company Name: Stonriver
Country: Angola
Contact:

Re: newbie question - scripting events

Post by leatherlips »

Back again with Scripting questions..
I have a chart that will use a database for it's values. It runs properly. Now I want to add a dropdown selection to allow the user to change the chart type (without having to go back to the RPG). I thought if I used the change event on the dropdown, that I should be able to use the choice value to update the chart type for re-display.

Being new to javascript and not having any kind of reference that describes all properties/events for the widgets, I'm at a loss on how to code the "change" event of the dropdown to do what I'm wanting.

I assume this should be a simple thing, but I can't figure out how to code that event properly....
Hany
New User
Posts: 19
Joined: Fri Jan 04, 2008 12:13 pm
First Name: Hany
Last Name: Elemary
Company Name: Profound Logic Software
Contact:

Re: newbie question - scripting events

Post by Hany »

I've looked into this closely with the rest of our development staff and found out that there is currently no elegant way to handle this. However, we have just put in a fix that will be available in the next version (2.1.7). This fix should should handle changing the selection via JavaScript easily.

Here is the code that will change the chart type dynamically with JavaScript. You should place this in the "onchange" event of the dropdown box:

Code: Select all

var chart = getObj("Chart1");  //assuming the id of the chart is "Chart1"
applyDesignProperty(chart, "chart type", this.value); //this.value is the current selection of the dropdown
applyDesignProperty(chart, "field type", "chart");
Let me know if this helps or if you need additional info.

Hany
leatherlips
Profound User
Posts: 83
Joined: Sun Oct 03, 2010 8:45 am
First Name: Mike
Last Name: Geldert
Company Name: Stonriver
Country: Angola
Contact:

Re: newbie question - scripting events

Post by leatherlips »

WOW, you guys are great! That's what I call service. Thanks!!!
leatherlips
Profound User
Posts: 83
Joined: Sun Oct 03, 2010 8:45 am
First Name: Mike
Last Name: Geldert
Company Name: Stonriver
Country: Angola
Contact:

Re: newbie question - scripting events

Post by leatherlips »

Hi again, I just tested out the code listed to change a chart's type dynamically with Java script, and it did not seem to work. I used the code exactly as is (in the onchange event of the Dropdown) and validated the name of the chart is indeed Chart1. I receive this error:
"Onchange Error: applyDesignProperty is not defined"
Any ideas on what I might be doing wrong?
(I have upgraded to 2.18).

Thanks!
User avatar
Alex
Profound Logic Staff Member
Posts: 233
Joined: Fri Jan 04, 2008 12:10 pm
First Name: Alex
Last Name: Roytman
Company Name: Profound Logic Software
Contact:

Re: newbie question - scripting events

Post by Alex »

Try applyProperty instead of applyDesignProperty.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests