hb_hrbRun scripts ...

Post Reply
User avatar
Rimantas
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

hb_hrbRun scripts ...

Post by Rimantas »

Hi,

Here is a small sample for the problem ...

Code: Select all | Expand


#include "FiveWin.ch"
#include "InKey.ch"
#include "xBrowse.ch"

function sal_orders()
private oChild, oBrw
private cAls := oApp:GetNewAlias( "SALES" )

if !oApp:OpenNewAlias( "SALES", cAls )
   return( NIL )
endif

select( cAls )

DEFINE WINDOW oChild TITLE "Sales orders" MDICHILD OF oApp:oWnd

@ 0,0 XBROWSE oBrw OF oChild ALIAS Alias()

oBrw:CreateFromCode()
oBrw:cToolTip = "This is a sales orders"
oChild:oClient := oBrw
oChild:bValid  := { || ( .t., MsgInfo( "before" ), ( cAls )->( dbclosearea() ), MsgInfo( "after" ) ) }

ACTIVATE WINDOW oChild ON INIT oBrw:SetFocus()

return( NIL )  
 


I'm running prgs as scripts from hb_hrbrun() function . This sample is working , but ending this window , the main program hangs up and I must to close through task manager . The main reason of hangs up is oChild:bValid row - "after" msg doesn't appears . If comment this row , all is working OK . But I must to close this alias .. :-) . It seems that hb_hrbrun can't to do validation codeblock for window or close alias ... Tried without dbclosearea() - the same . So maybe it's problem of execution of codeblock ...

Thanks in advance for any ideas or comment !

Working enviroment : FW 9.05 , Harbour 2.0 a beta , BCC 5.5.1
Rimantas U.
User avatar
Rimantas
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Re: hb_hrbRun scripts ...

Post by Rimantas »

Rimantas wrote:Hi,

Here is a small sample for the problem ...


It seems that with hb_hrbrun there aren't working mans ... :-(
Rimantas U.
User avatar
Antonio Linares
Site Admin
Posts: 42879
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 209 times
Been thanked: 124 times
Contact:

Re: hb_hrbRun scripts ...

Post by Antonio Linares »

Rimantas,

You can't use a private variable here:

private cAls := oApp:GetNewAlias( "SALES" )

because a MDICHILD window is non modal so the execution continues after activating the window and the private variable gets destroyed.

Use a local variable instead of a private, and it should work fine :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Rimantas
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Re: hb_hrbRun scripts ...

Post by Rimantas »

Antonio Linares wrote:Rimantas,

You can't use a private variable here:

private cAls := oApp:GetNewAlias( "SALES" )

because a MDICHILD window is non modal so the execution continues after activating the window and the private variable gets destroyed.

Use a local variable instead of a private, and it should work fine :-)


Thanks , Antonio , for your advice ! :) . I didn't try this , but believe , that this will be solved . I have another question - can I manage a script as object ? Now I programmed in this style - created one class , for sample "TSales" , in which exist DATA oChild , oBrw and methods for managment . In the main prg I'm creating oObj := TSales():New() and also put in array of all object { "sales", salesWindowHandle } . Then I know which object are opened , can manage them - this works perfect for me . Can I do something like that as desribed with scripts ?

Many thanks in advance ! With best regards !
Rimantas U.
Post Reply