LaunchFolderWindow

Posted by descom on 14-Apr-2004 23:19

Hi,

I am using Dynamics V2.1A01 and am having problems with launching the correct child window for a dynamic browse.

I have a parent browse that has two possible child windows, depending on the record type of the parent record.

In the super procedure for the parent browse I have a launchfolderwindow procedure which sets the value of the folderwindowtolauch attribute depending on the record. So far so good.

If I launch the child window by the default action of double clicking on the browse record, or by selecting view from the browse toolbar, the correct child window is launched. This works fine.

However, what do I do when one of the child windows is already launched, but I change the highlighted record in the parent browse with a single mouse click?

I want it to close the incorrect child window and launch the correct child window.

Does anyone know how I can achieve this?

Thanks, Natalie.

All Replies

Posted by palo on 26-Apr-2004 13:05

as I understood your problem, you want to RUN DestroyObject in handle of your 'child' window, according selection in your dynamic browser.

Step 1.

You have two possibilities for starting selection at DynBrow;

1st one: you can implement 'MOUSE-SELECT-CLICK' at your custom super procedure for current DynBrowser (according 'Implementation of not supported UI-TRIGGERS into Dynamics' at this forum from March 8th 2004)

2nd one: you can put it after 'SUPER' of DataAvailable override procedure at your custom-superprocedure for yours' DynBrow. (maybe also in onValueChanged procedure)

Step 2.

You have to put behaviour, which find handle of actually opened child and destroy his object.

1st possibility:

e.g. code for DataAvailable at DynBrow custom-superprocedure should look like:

DEFINE INPUT PARAMETER pcRelative AS CHARACTER NO-UNDO.

DEFINE VARIABLE hChildWindow AS HANDLE NO-UNDO.

DEFINE VARIABLE hContainerSource AS HANDLE NO-UNDO.

DEFINE VARIABLE cWindowToLaunch AS CHARACTER NO-UNDO INIT "wdv_company".

DEFINE VARIABLE iTarget AS INTEGER NO-UNDO.

RUN SUPER(pcRelative).

.

iTarget = LOOKUP(cWindowToLaunch, DYNAMIC-FUNCTION('getInstanceNames':U IN hContainerSource)).

IF iTarget > 0 THEN

ASSIGN

hChildWindow = WIDGET-HANDLE(ENTRY(iTarget, DYNAMIC-FUNCTION('getContainerTarget':U IN hContainerSource))).

IF VALID-HANDLE(hChildWindow) THEN

RUN DestroyObject IN hChildWindow.,

where cWindowToLaunch should be name of your dynFold.

2nd possibility:

if you are using mouseselectclick -procedure,

DEFINE VARIABLE hChildWindow AS HANDLE NO-UNDO.

DEFINE VARIABLE hContainerSource AS HANDLE NO-UNDO.

DEFINE VARIABLE cWindowToLaunch AS CHARACTER NO-UNDO INIT "wdv_company".

DEFINE VARIABLE iTarget AS INTEGER NO-UNDO.

.

iTarget = LOOKUP(cWindowToLaunch, DYNAMIC-FUNCTION('getInstanceNames':U IN hContainerSource)).

IF iTarget > 0 THEN

ASSIGN

hChildWindow = WIDGET-HANDLE(ENTRY(iTarget, DYNAMIC-FUNCTION('getContainerTarget':U IN hContainerSource))).

IF VALID-HANDLE(hChildWindow) THEN

RUN DestroyObject IN hChildWindow.

....

Step 3.

I hope, that it was helpfull, if you have any questions, I am still living:-))

palo

(c) pavol drozd, Brain Stars Consuling Group Slovakia

Posted by palo on 26-Apr-2004 13:09

btw. Service pack 02 for dynamics 2.1 is also available:-)

This thread is closed