window release method compile error

Moderator: Rathinagiri

bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

window release method compile error

Post 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
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: window release method compile error

Post by mol »

It's impossiple to analyze your code without complete sample.
bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

Re: window release method compile error

Post 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
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: window release method compile error

Post by mol »

Try to declare window by

Code: Select all

declare window Form_3
Paste error message here, too.
User avatar
serge_girard
Posts: 3165
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: window release method compile error

Post by serge_girard »

Hi Bluebird,

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

Serge
There's nothing you can do that can't be done...
bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

Re: window release method compile error

Post 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
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: window release method compile error

Post by mol »

try to build whole complete working sample. Respect our time, please...
User avatar
dragancesu
Posts: 921
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: window release method compile error

Post by dragancesu »

Can you zip files and attach?
User avatar
serge_girard
Posts: 3165
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: window release method compile error

Post 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
There's nothing you can do that can't be done...
User avatar
danielmaximiliano
Posts: 2612
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: window release method compile error

Post 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  
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Post Reply