window release method compile error

Moderator: Rathinagiri

bluebird
Posts: 167
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF
Has thanked: 49 times
Been thanked: 7 times

window release method compile error

Post by bluebird » Tue Dec 27, 2016 12:51 am

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: 3227
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 224 times
Been thanked: 127 times
Contact:

Post by mol » Tue Dec 27, 2016 6:41 am

It's impossiple to analyze your code without complete sample.

bluebird
Posts: 167
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF
Has thanked: 49 times
Been thanked: 7 times

Post by bluebird » Wed Dec 28, 2016 5:44 am

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: 3227
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 224 times
Been thanked: 127 times
Contact:

Post by mol » Wed Dec 28, 2016 6:19 am

Try to declare window by

Code: Select all

declare window Form_3
Paste error message here, too.

User avatar
serge_girard
Posts: 2346
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 589 times
Been thanked: 124 times
Contact:

Post by serge_girard » Wed Dec 28, 2016 4:23 pm

Hi Bluebird,

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

Serge

bluebird
Posts: 167
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF
Has thanked: 49 times
Been thanked: 7 times

Post by bluebird » Wed Dec 28, 2016 7:05 pm

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: 3227
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 224 times
Been thanked: 127 times
Contact:

Post by mol » Wed Dec 28, 2016 9:00 pm

try to build whole complete working sample. Respect our time, please...

User avatar
dragancesu
Posts: 700
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia
Has thanked: 23 times
Been thanked: 149 times

Post by dragancesu » Thu Dec 29, 2016 6:39 am

Can you zip files and attach?

User avatar
serge_girard
Posts: 2346
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 589 times
Been thanked: 124 times
Contact:

Post by serge_girard » Thu Dec 29, 2016 8:54 am

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

User avatar
danielmaximiliano
Posts: 2153
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 162 times
Been thanked: 26 times
Contact:

Post by danielmaximiliano » Thu Dec 29, 2016 12:06 pm

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

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

Post Reply