GUI Smart Viewer Query

HI

Progress 9.1e v2 under windows – GUI using ADM2 Smart objects
I have a Smart Window with Smart Browser, Smart Data Object, Smart toolbar, and a folder with two Smart Data Viewers with database fields to be updated on them – quite standard - works perfectly.

Now the customer wants various conditions on a field (rowobject) in the first viewer to set up fields(rowobjects) in the second viewer.

Is there a way to do this?

Regards
 
Hi Joey,
Thanks for the speedy reply.

What is required is that the operator enters certain fields in viewer 1 and depending on those conditions, fields in viewer 2 are updated accordingly.

Simply - Say we have field1 in Viewer 1 (which is a field on the database - dbf1) and the operator changes it to "A", then a Field on Viewer 2 (again this is a fields on the database dbf2) should be set to "X".

So when the Viewer 2 is seleted the operator can see the change.

I hope I have explained it a bit better.
 

joey.jeremiah

ProgressTalk Moderator
Staff member
In ADM theres billions of hooks to add or extend to anything that happens in ADM, you can't just add a trigger because that might override one being used by ADM.

Secondaly you'll need to create a dynamic link, not one of the ready made static links to communicate from one viewer object to another.


Here's an example -

In the first (or source) viewer create a new procedure, choose override and the fieldModified procedure (look at the ADM reference). That's your hook.

Going over the list is an easy way to find or look for some hook.


At the end of the fieldModified procedure add -

Code:
publish "FieldModified" ( input phField:name ).

Which publishes a named event in the dynamic link we'll be creating.


In the second (or target) viewer add a new procedure named FieldModified that will be subscribed to the dynamic link.

And the following code -

Code:
define input param pcFieldName as char no-undo.

message pcFieldName view-as alert-box.


Go back to your SmartWindow, select procedure settings, SmartLinks.

Add a new link from the source to the target viewer and instead of selecting one of the static links select new and type FieldModified.

That's it. The dynamic link is in (just to make sure re-open the SmartLinks dialogbox and verify the link has been added).


Another thing is, if the viewers are on different pages the second viewer won't be initialized (run persistent) until it's viewed, maybe, when it's tab folder is selected.

To fix that problem create an override procedure in the SmartWindow named initializeObject and use run initPages( "<page1>,<page2> ..." ) to initialize (without viewing) the pages the viewers are on.

Tested on OE10.0B.

Goodluck !
 

joey.jeremiah

ProgressTalk Moderator
Staff member
BTW this was just a simple example.

Using FieldModified for the procedure and link name probably wouldn't be a good idea since theres already a procedure with the same name in the ADM class hierarchy (and a ValueChanged procedure).

There shouldn't be any conflicts in the sample posted but for the real thing go with something more specific, like, OrderNumChange.
 
Top