help with browse

Flipkonijn

New Member
Hello,

i need to get data out of a browse, and in to a field. I figuered out I need to do that with the column and screen-value andso, but the problem is that the browse is in an other window than the field.

Is it possible to do that, or must the field and the browse be in the same window??

i hope you understand my question.

thank you guys very much in advance.
 
No, it does not matter that the browse and field(s) are in another window and you should not have to use the screen value and columns of the browse either.

I don't know your code, but you could for instance put a trigger on the browse (value-changed) and inside the trigger run an internal procedure in the other window - passing it the buffer of the table in the browse. In the internal procedure that is run from within the trigger of the browse you can then display the values in the fields.

If you use v9 and up you can also use publish and subscribe to do this. And I bet there are quite a few other solutions as well, but for that it would be helpful to know a bit more about your code...
 
If you are using Windows then simply;
DO WITH FRAME {&FRAME-NAME}:
APPLY 'ENTRY' TO widget/fieldname/where you wish focus to be
END.
 
Just pass the ROWID, in the first window get the desired records ROWID. Then when you execute the second window pass the ROWID of the record. You will then be able to FIND the record where the ROWID matches.
 
its still not working.

The browse is in a masterfile. So the link between my browse and my tree is the smartObject that contains the masterfile of my browse.
So is it possible to run a procedure from in my main window (with the tree, and the smartObject) when a trigger is fired in my masterfile?

i use a procedure called fillTree to fill my tree. In that procedure the data from the selected row is asked to the masterfile of my browse. This happens the first time when i begin my program.
But when i select another row in my browse, i want the value-changed trigger to run the fillTree procedure in my main window.
Is this possible??

I don't know your code, but you could for instance put a trigger on the browse (value-changed) and inside the trigger run an internal procedure in the other window - passing it the buffer of the table in the browse. In the internal procedure that is run from within the trigger of the browse you can then display the values in the fields.

you say, inside the trigger, i have to run an internal procedure in the other window, but how do i run a procedure in another window?
i have tried with "run procedure in window window-name", but that doesn't work. Maybe im using the wrong window-name. what name do i have to use?
is it the name of the program, for example program-name.w or the name of the window, for example W-Win?

Hope someone can help me, cause i get realy frustraited :(

tnx in advance
 
Hmmm sounds like you have not been using Progress for a long time. I hope I get your story right now, but here goes:

To run an internal procedure in another window (which is actually a procedure itself) you will need the procedure handle of the procedure (window) that holds your TreeView and smart thing. A procedure handle is completely different from a window handle. The window handle you are trying to use is the handle to the User Interface object - the window and has nothing to do with the handle of the procedure that created the window.

From what I read it is probably a lot simpler (and more transparent) to use SUBSCRIBE and PUBLISH instead of running internal procedures.

Somehow all these procedures (so the .w files) need to be started, so the first basic question is:
- Does the procedure with the TreeView initially run the one with the browse or is it the other way around?

If the TreeView runs the browse procedure (so I am talking about initially) you will have something like:
RUN browseprocedure.w PERSISTENT SET handleToBrowse [(Parameters if it has any)].

After this run statement you can put:
SUBSCRIBE PROCEDURE THIS-PROCEDURE TO "dataChanged":U IN handleToBrowse.

IF it is the other way around (so the browse initially runs the TreeView)
RUN treeviewprocedure.w PERSISTENT SET handleToTreeView [(Parameters if it has any)].

After this run statement you can put:
SUBSCRIBE PROCEDURE handleToTreeView TO "dataChanged":U IN THIS-PROCEDURE.

Now all you have to do is create an internal procedure "dataChanged" in the TreeView, with a parameter, which is of type ROWID.

PROCEDURE dataChanged:
DEF INPUT PARAMETER ipRowid AS ROWID NO-UNDO.

/* if you need this you can now find the record of the table in the browse by using the rowid FIND tableName NO-LOCK WHERE ROWID(tableName) EQ ipRowid NO-ERROR. */

/* do whatever you need to do to refresh your TreeView */
RUN fillTree.
END PROCEDURE.

In the VALUE-CHANGED trigger of the browse you can then put:
IF AVAILABLE nameOfTableInTheBrowse
THEN PUBLISH "dataChanged":U (INPUT ROWID(nameOfTableInTheBrowse)).
ELSE PUBLISH "dataChanged":U (INPUT ?).

When the user now clicks another row in the browse, the dataChanged "trigger" fires and either sends the ROWID or an unknown value to whatever procedure is listening to the event (which would be the TreeView procedure). That procedure receives the rowid (or unknown value) and refreshes the TreeView. Simple ;-)

I know I did a lot of typing above, but if you take out the explanation the amount of code required to make this work is minimal and not really that difficult. Maybe you are well of to lookup "PUBLISH" and "SUBSCRIBE" in the Progress documentation.
 
My God, its working!! I cant thank you enough! really, thank you so much, if everybody would be as kind and helpful as you, the world would be a better place to live!!

Thanks for your patiance with me! Im a student that has to renew a progress program, but i never studied progress. i dont know much about progress, but thanks to you, i did manage my objectif!!

thanks again jongpau

:toast: cheers mate.​
 
Back
Top