Page 1 of 2

window release method compile error

Posted: Tue Dec 27, 2016 12:51 am
by bluebird
I must have a fundamental problem understanding methods.

I want to release a window then go back to a previous one. In the code below, why does the build give me a syntax error
at either the hide or release command at the end. Form_1 is the destination after leaving form_3

*------------------------------------------------------------*
FUNCTION BackToInputScreen //called from SelectInput
*------------------------------------------------------------*

Form_1.setfocus
if lUseTestData //
xDummy:=ScanToFillBlanks(.f.)
else
Form_1.ebox_1.visible:=.T. //get numbers
Form_1.ebox_1.setfocus
Form_1.Lbl_3.visible:= .T. //instructions

endif
Form_1.startbutton.visible:= .F.
Form_1.updatearray.visible:= .T.
Form_1.updatearray.setfocus
//Form_3.hide
Form_3.release
RETURN NIL

Re: window release method compile error

Posted: Tue Dec 27, 2016 6:41 am
by mol
It's impossiple to analyze your code without complete sample.

Re: window release method compile error

Posted: Wed Dec 28, 2016 5:44 am
by bluebird
To Mol

The complete code is way too big

The HMG reference for the release method just says that <windowname>.release will close it
That sounds simple but it is not happening on the last line either for Hide or release.

Is there anything else that any user should know about using a method?

Thanks

Re: window release method compile error

Posted: Wed Dec 28, 2016 6:19 am
by mol
Try to declare window by

Code: Select all

declare window Form_3
Paste error message here, too.

Re: window release method compile error

Posted: Wed Dec 28, 2016 4:23 pm
by serge_girard
Hi Bluebird,

Maybe a small part of the program will be sufficient to understand the problem?

Serge

Re: window release method compile error

Posted: Wed Dec 28, 2016 7:05 pm
by bluebird
Thanks to those kind souls who responded

error is Error E0030 syntax error " Syntax error at '.'"

Code below shows window Form_3 and function called to exit back to Form_1

*------------------------------------------------------------*
FUNCTION SELECTINPUT() //Called from Startup Button
*------------------------------------------------------------*

If !IsWindowDefined(Form_3)
DEFINE WINDOW Form_3 ;
AT 290,290 ;
WIDTH 400 ;
HEIGHT 300 ;
BACKCOLOR GREEN ;
TITLE "Choices"


@ 50 ,100 BUTTON Button_1 ;
PARENT Form_3;
CAPTION "Click to Use Set Values" ;
ONCLICK {||(lUseTestData:=.t.,BackToInputScreen())} ;
WIDTH 200 ;
FONT "Arial" SIZE 12 ;
HEIGHT 35

@ 100 ,100 BUTTON Button_2 ;
PARENT Form_3;
CAPTION "Click to enter New Values" ;
ONCLICK {||(lUseTestData:=.f.,BackToInputScreen())} ;
FONT "Arial" SIZE 12 ;
WIDTH 200 ;
HEIGHT 35
END WINDOW

ACTIVATE WINDOW Form_3
Else
Form_3.setfocus

Endif
RETURN NIL

*------------------------------------------------------------*
FUNCTION BackToInputScreen() //called from SelectInput
*------------------------------------------------------------*

Form_1.setfocus
if lUseTestData //
xDummy:=ScanToFillBlanks(.f.)
else
Form_1.ebox_1.visible:=.T. //get numbers
Form_1.ebox_1.setfocus
Form_1.Lbl_3.visible:= .T. //instructions

endif
Form_1.startbutton.visible:= .F.
Form_1.DisplayClues.visible:= .T.
Form_1.DisplayClues.setfocus
//Form_3.hide
Form_3.release

RETURN NIL

Re: window release method compile error

Posted: Wed Dec 28, 2016 9:00 pm
by mol
try to build whole complete working sample. Respect our time, please...

Re: window release method compile error

Posted: Thu Dec 29, 2016 6:39 am
by dragancesu
Can you zip files and attach?

Re: window release method compile error

Posted: Thu Dec 29, 2016 8:54 am
by serge_girard
Hello Bluebird,

Extremly difficult without main function. I tried to make the main function myself (as simple as possible) and it seems working.
See below:

Code: Select all

#include "hmg.ch"
 
DEFINE WINDOW Form_1 ;
	AT 0,500 ;
	WIDTH  1300 ;		 
	HEIGHT 850 ;	    
	TITLE 't'  ;
	BACKCOLOR SILVER;
	MAIN  ;
   ON INIT SELECTINPUT();


END WINDOW

ACTIVATE WINDOW Form_1


*------------------------------------------------------------*
FUNCTION SELECTINPUT() //Called from Startup Button
*------------------------------------------------------------*
//lUseTestData := .f.
If !IsWindowDefined(Form_3)
   DEFINE WINDOW Form_3 ;
      AT 290,290 ;
      WIDTH 400 ;
      HEIGHT 300 ;
      BACKCOLOR GREEN ;
      TITLE "Choices"


      @ 50 ,100 BUTTON Button_1 ;
      PARENT Form_3;
      CAPTION "Click to Use Set Values" ;
      ONCLICK {||(lUseTestData:=.t.,BackToInputScreen())} ;
      WIDTH 200 ;
      FONT "Arial" SIZE 12 ;
      HEIGHT 35

      @ 100 ,100 BUTTON Button_2 ;
      PARENT Form_3;
      CAPTION "Click to enter New Values" ;
      ONCLICK {||(lUseTestData:=.f.,BackToInputScreen())} ;
      FONT "Arial" SIZE 12 ;
      WIDTH 200 ;
      HEIGHT 35
   END WINDOW

   ACTIVATE WINDOW Form_3
Else
   Form_3.setfocus
Endif
RETURN NIL





*------------------------------------------------------------*
FUNCTION BackToInputScreen() //called from SelectInput
*------------------------------------------------------------*

Form_1.setfocus
if lUseTestData //
   xDummy:= '' //ScanToFillBlanks(.f.)
else
   //Form_1.ebox_1.visible:=.T. //get numbers
   //Form_1.ebox_1.setfocus
   //Form_1.Lbl_3.visible:= .T. //instructions
endif

//Form_1.startbutton.visible:= .F.
//Form_1.DisplayClues.visible:= .T.
//Form_1.DisplayClues.setfocus
//Form_3.hide
Form_3.release

RETURN NIL
Serge

Re: window release method compile error

Posted: Thu Dec 29, 2016 12:06 pm
by danielmaximiliano
Hi BlueBird ....

Code: Select all

  IF !IsWindowDefined( Stock )   ..... You Form_3                         
      Load Window .\Formularios\Stock
      ON KEY SHIFT + DELETE OF Stock ACTION .......
      ON KEY F3 OF Stock ACTION ......
      DesactivarEdicion()
      ConectarStock( .T. )
	  Stock.Activate
   Else
      ConectarStock( .T. )
      Stock.Restore
      Stock.Setfocus
   EndIf