New window from a browse

Hello

I am thinking about the possibility of creating several windows from a browse. Lets say I have a browse with contacts. I would like to open several windows from that browse, showing various contacts at the same time, because many times you need to have info from several contacts available. No update is necessary, just info.
I thought of perhaps creating a routine picking up info from hotfields on a browse, showing them in a new window (mdichilds).
Are there somebody here that could lead me in the the right direction, perhaps with some code examples?

Brgds Werner

Perhaps add a parameter to a window to represent the contact ID, then START that procedure and fetch the correct record based on the parameter passed.

2 Likes

I dont really know to use parametres in windows.
So far I have managed to open several mdichildwindows from a button on the browse.
I use local variables for id, firstname, lastname, phone and email connected to strings in the window.
I then use a formula to copy values from the browse fields into the local variables. The formula is set up to run on opening the window. So far it doesnt display anything from the browse.

Passing parameters is worth knowing … Open this page and type 481 in the search box:
https://www.clarionlive.com/BrowseEpisodes/ww

#481 Passing Parameters - Back To Basics! SEP 28,2018
Mike Hanson
What are parameters? What are prototypes? How do you move data between procedures? What can be passed? How do you pass a queue? An object? So many questions! Mike Hanson is here to help, with a thorough discussion with examples on passing parameters!

I think Mike has done articles and presentations on a Threaded Form off a Browse to have multiple open for update.

2 Likes

Thanks for the reply. I have tried to pass variables, both with local data and global data. Local data didnt work - even with assignments from the browse. Global variables did work. The only problem was that when I openened multiple windows they showed the same global data, which was not my intention. I will look into your suggestions.
This shouldnt have to be so difficult. This can be a piece of cake in other languages. Sometimes I think the templates complicate things, instead of making things easier.

Honestly, parameter passing in Clarion is not difficult either. Understanding how it should be done using templates might take a bit of learning, but the weak variable typing often makes it much easier than a strongly typed language.

Hi,

When I want to do this I find the BrowseNoRecordsButton template provides a great start to load the focused record into the thread buffer. If you need several windows at once, it forces you to have new threads, (whereas one at a time, close, go back then open another is simple and runs on the same thread). You can then seed new threads with a STRING parameter to START(). To get it to work with non-strings you need another variable to effectively ‘cast’ the datatype using Clarion built in conversions via an assignment prior to the callout and, for clarity, on the receiving end too.
You have to be careful though with separate threads because they can easily become focused on different records and changed data. That can cause user misunderstanding and error, even if the child windows are view only. You might have to do plenty of thread notification to keep all in line, depending on the application.

Regards, Jim

It’s actually pretty simple. Add a button to open info on the highlighted record and in the .TakeAccepted embed, do something like this:

GET(BrowseQ, CHOICE(?BrowseQ))
START(YourDisplayProcedure(BrowseQ.PrimaryKeyValue), 10000)

BrowseQ is the QUEUE name referenced by your browse listbox and ?BrowseQ is the FEQ of the browse list control. BrowseQ.PrimaryKeyValue) is the record in the QUEUE that holds the primary key field value of the table being browsed.

YourDisplayProcedure is the Window or Source procedure you use to show the information about the selected browse record. It should be declared with parameters something like this:

YourDisplayProcedure(STRING pPrimaryKeyValue)

It should list the table(s) needed in the Tables for the procedure.

If you are using an ABC Window template procedure, then in ThisWindow.Init, after opening your files, first make sure the tables are actually open by adding something like the following for each file you will be using:

Access:YourFileName.UseFile
(You don’t need to add the above line if it is already placed there by the template)

Followed by:

YFN:PrimaryKeyField = pPrimaryKeyValue (YFN is the table prefix)
Access:YourFileName.Fetch(YFN:PrimaryKey)

You can add secondary lookups as needed.

(this can be in an embed before or shortly after SELF.Open(QuickWindow))

Thanks for your replies. I will look into them when Clarion starts working correctly again…(See other tread).

With regard to my message above. I had to change UI language back to English because control templates were not working anymore …