After Drag and Drop - How to Refresh Browse or List running on a different thread

Greetings,
After dragging from a BrowseA to a WindowB, the DROP process updates a value in a table (BBB:Status=1) which is also being displayed in the original BrowseA as a TickBox/Icon.

I.E. When DROP was a success, Field BBB:Status in BrowseA should show a “Tick box”
Currently the User has to click a [RefreshButton] on BrowseA-window that executes "thiswindow.reset(1) to refresh BrowseA.

How can the BrowseA be refreshed at the time of drop from WindowB?
Post(EVENT:WHATWHERE , , BrowseAThreadNo) ???

Thanking all in advance…

If you don’t want to store the thread # in a variable or you may get drops from more than one window.
In BrowseA but code in Event:Drag and change the DropID to contain your thread number

If DRAGID() = 'WhatEverYourDragIDIs'
  SetDropID(DROPID() & ';' & Thread())
end

The in your DROP logic in WindowB, spit the DROPID on ‘;’. First half is the normal DROPID the second half is the thread to send a notify message to.

1 Like

DROPID()/DRAGID() also have a thread (and a control) parameter.

2 Likes

Learn something everyday! Thanks, Jeff.
You can use my technique to pass additional information.

1 Like

Thank you Jeff and Rick.
The thread of the window where BrowseA , “?Browse:1”, is hosted is stored in BrowseAThreadNo.

What next?
What command to POST?
The help on POST shows one can create a user defined event. Must a User Defined Event be created in the BrowseA-window? I have no idea how to do that, if this is the way to execute “thiswindow.reset(1)” to update the BrowseA

Not sure what needs to go into the POST from WindowB?

Post( :point_right:EVENT:WHATCOMMAND :point_left:, , BrowseAThreadNo)

You would use a user defined event or NOTIFY with a value of your choosing. Then send that event/notification to the thread in question. In that target thread’s procedure, check for that event then do your refresh when it is received.

I would use NOTIFY, too. Then in BrowseA you can catch the notification in the TakeNotify method.

Thank you
That worked.
In Global Embeds [After Global Data]

EVENT:pRefreshBrowseFromFile EQUATE (490H)
EVENT:pRefreshWindow EQUATE (491H)

In the BrowseA Procedure

OF ?Browse:1

OF EVENT:Drag
  ! [Priority 5000]
    If DRAGID()    = 'MyDragID'                                       
        SetDropID(DROPID() & ';' & Thread())
    END

also After “OF EVENT:sized”

OF EVENT:pRefreshBrowseFromFile    !EQUATE (490H)       !FRX
    brw1.ResetFromFile()                                        
    
OF EVENT:pRefreshWindow    !EQUATE (491H)  
    ThisWindow.Reset(1)

Then in WindowB
OF Event:Drop

Post(EVENT:pRefreshWindow, ,SUB(DROPID(),INSTRING(‘;’,DROPID(),1,1)+1,3))

Thank you Everyone.

1 Like