Running a smart dialog from a .net window

Posted by Darren Parr on 09-Oct-2012 04:53

Hi

Has anyone noticed that when running a smart dialog from a .net window using a simple RUN statement that it all falls over. This is because active-window or current-window don't make much sense. I would be interested how anyone else has gotten around this. I have commented the offending code in containr.i to get around it, but don't like doing this as its gets wiped out on updates. I prefer a better solution.

Here is the section in the defs section of containr.i. Oh BTW this iss 11.1.

/* make the window's max size the session size, but do it no-error

   as window-name may be current-window with no window (serverside sbo) */    

&IF '{&WINDOW-NAME}' <> '':U &THEN

  /* Avoid this if current-window = {Window-name} already. (a suppressed window) */

  /* The current-window will be set to {&window-name} later for a normal window */ 

  IF {&WINDOW-NAME} <> CURRENT-WINDOW THEN

  DO:

    /* only change if the max-width is default */

    IF {&WINDOW-NAME}:MAX-WIDTH = {&WINDOW-NAME}:VIRTUAL-WIDTH THEN 

      {&WINDOW-NAME}:MAX-WIDTH  = SESSION:WIDTH - 1 NO-ERROR.


    /* only change if the max-height is default */

    IF {&WINDOW-NAME}:MAX-HEIGHT = {&WINDOW-NAME}:VIRTUAL-HEIGHT THEN 

      {&WINDOW-NAME}:MAX-HEIGHT = SESSION:HEIGHT - 1 NO-ERROR.


  END.

&ENDIF

I can't really consider undefining WINDOW-NAME as it could cause me problems.

Regards

Darren

All Replies

Posted by rbf on 09-Oct-2012 05:05

Hi Darren,

Indeed when mixing .NET and GUI and especially when embedding GUI windows in .NET you will need to find alternatives for ACTIVE-WINDOW and sometimes CURRENT-WINDOW.

I have found that in most cases you can easily achieve this.

At first glance I don't think the code below falls over, because {&WINDOW-NAME} should be valid and CURRENT-WINDOW does not need to be valid and the assign statements contain NO-ERROR, but I suppose you could easily remove the if condition:

  IF {&WINDOW-NAME} <> CURRENT-WINDOW THEN

  DO:

as it does not add much value in this case (sorry don't know what a current-window with no window in case of an sbo on the server is) and it does not hurt.

In the case of SmartObjects I suppose you could also/additionally report this to Tech Support so they can make that code suitable for mixed environments in future releases.

HTH

Posted by Darren Parr on 09-Oct-2012 08:48

Hi

In a smart dialog, theere is a statement between defs and the main block which redefines &window-name to active-window which is why it all falls over. I guess its just that there is no check against window-name being valid. I've ignored the code unless adm-container is set to window. Still not a good way of doing this other than changing containr.i.

Never mind. Thanks

-Darren

Posted by Peter Judge on 09-Oct-2012 09:19

Could you pass &WINDOW-NAME as an argument into containr.i ?

{src/adm2/containr.i &WINDOW-NAME="window-1"}

I think that'll work.

-- peter

Posted by Darren Parr on 11-Oct-2012 11:33

Sorted it. I just checked the value isnt ? in containr.i for now. I could have changed the defintion to pass window-name but decided agianst it as it needed me to change quote alot of dialogs.

Thanks

Darren

Posted by Wouter Dupré on 11-Oct-2012 11:38

Hi,

Thank you for your email. I'm out of the office on Thursday afternoon and will be back Friday morning. During my absence I will have no/limited access to email and phone. For urgent matters, please call our office, or contact Jiri De Jagere (jdejager@progress.com).

Kind regards,

Wouter

--

Wouter Dupré

Senior Solutions Consultant

Progress Software NV

A. Stocletlaan 202 B | B-2570 Duffel | Belgium

Office +32 (0) 15 30 77 46 | Mobile +32 (0) 478 50 00 49

This thread is closed