Page 1 of 1

Need Ideas

PostPosted: Fri Nov 07, 2014 3:31 am
by TimStone
I've been playing with this problem for 2 days. Here is a simple piece of code.

Stand alone it works fine. However, if I put it into my program, and call it with a button, it behaves incorrectly.
It does not stop at the Activate. Instead, it displays the browse window and immediately goes to the MsgInfo.

This is a simple reproduction of a failing segment in a larger routine. Please note the details after the code.

Also, all browses already established in the program work fine, and there is no duplication of the code here within any other part of the program.

Code: Select all  Expand view

function new8()

   local oWndT, oBrwT
                                 
   use c:\asw9s\eglskt shared

   DEFINE WINDOW oWndT

   @0,0 xbrowse oBrwT ;
      columns "KITCOD","KITYR" ;
      HEADERS "Kit Code", "Year" ;
      of oWndT ;
      DATASOURCE alias() ;
       ON DBLCLICK( oWndT:end() )
               
   oBrwT:CreateFromCode()
   oWnd:oClient:= oBrwT
               
   ACTIVATE WINDOW oWndT
   msgInfo("Done")
RETURN nil

 


Using:

FWH 14.09
Harbour ( for MSFT )
Microsoft Visual Studio 2013

Thanks for any ideas you may have.

Re: Need Ideas

PostPosted: Fri Nov 07, 2014 3:58 am
by fafi
Hi Tim..
Tyr this :

Code: Select all  Expand view

function new8()

   local oWndT, oBrwT, lExit := .f.
                                 
   use c:\asw9s\eglskt shared

   DEFINE WINDOW oWndT

   @0,0 xbrowse oBrwT ;
      columns "KITCOD","KITYR" ;
      HEADERS "Kit Code", "Year" ;
      of oWndT ;
      DATASOURCE alias() ;
       ON DBLCLICK( lExit := .t., oWndT:end() )
               
   oBrwT:CreateFromCode()
   oWnd:oClient:= oBrwT
               
   ACTIVATE WINDOW oWndT  valid lExit
   msgInfo("Done")
RETURN nil

 

Re: Need Ideas

PostPosted: Fri Nov 07, 2014 4:35 am
by Antonio Linares
Tim,

Is your main window MDI ?

Re: Need Ideas

PostPosted: Fri Nov 07, 2014 4:46 am
by TimStone
No, SDI. My clients had continuous problems with MDI..

Re: Need Ideas

PostPosted: Fri Nov 07, 2014 5:59 am
by Antonio Linares
Tim,

ok.

windows are not modal, that means that they don't stop the execution flow.

If you need to stop there, then we may need to use a loop there until a certain condition is matched.

Re: Need Ideas

PostPosted: Fri Nov 07, 2014 7:03 am
by fraxzi
Tim,

Use Dialog instead.

2 cents.

Re: Need Ideas

PostPosted: Fri Nov 07, 2014 8:13 am
by Antonio Linares
Frances,

Yes, thats the best solution :-)

Re: Need Ideas

PostPosted: Fri Nov 07, 2014 12:43 pm
by MOISES
Timm,

If you need to use a Window, please check StopUntill at source\rpreview.prg.

Re: Need Ideas

PostPosted: Fri Nov 07, 2014 4:23 pm
by TimStone
Once Antonio asked that question I immediately tried a Dialog and it resolved the problem.

Sometimes we just look at something far too long and the answers hide.

Tim