HMG.3.4.2

HMG Unicode versions 3.1.x related

Moderator: Rathinagiri

User avatar
srvet_claudio
Posts: 1943
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 30 times
Been thanked: 117 times
Contact:

Re: HMG.3.4.2

Post by srvet_claudio » Wed May 04, 2016 3:11 pm

mol wrote: 1) while control is moved to debugger window, application should be blocked. Now, When focus is set to debugger window, you can operate on application and it causes errors.

2) I'm using two displays in my work - is there a way to remember position of debug window (on the second screen) and recall these coordinates at next run?
I am sorry but I do not understand
mol wrote:there was splitted area of source code with evaluation area in traditional debugger. Could it be done in this way in your solution, Claudio?
I wrote down on my to-do list.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com

User avatar
mol
Posts: 2828
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 118 times
Been thanked: 62 times
Contact:

Post by mol » Thu May 05, 2016 12:51 pm

Sorry for my bad English, I want to place sample and some screenshots to illustrate what about I'm thinking.
First - Run this sample in debugger mode:

Code: Select all

/*
 * HMG - Harbour Win32 GUI library
 * Copyright 2002-2008 Roberto Lopez <mail.box.hmg@gmail.com>
 * http://www.hmgforum.com//
*/

#include "hmg.ch"

Function Main()

set century on
set date ital

   DEFINE WINDOW Form_1 ;
      AT 0,0 ;
      WIDTH 400 ;
      HEIGHT 200 ;
      MAIN;
      TITLE 'Test'

      @ 30,70 BUTTON Button_1 CAPTION "Run test" WIDTH 200 HEIGHT 50 ACTION CallForm2()
   
   END WINDOW

   CENTER WINDOW Form_1

   ACTIVATE WINDOW Form_1

Return
*--------------
FUNCTION CallForm2
 
	DEFINE WINDOW Form_2 ;
	  AT 0,0 ;
      WIDTH 400 ;
      HEIGHT 200 ;
      TITLE 'second window...';
      MODAL

      @ 10,10 LABEL LABEL_1 VALUE "This is only label..."
      @ 30,70 BUTTON Button_1 CAPTION "CALL DEBUGGER ALTD()" WIDTH 200 HEIGHT 50 ACTION TestLabelValue()
   
   END WINDOW

   CENTER WINDOW Form_2

   ACTIVATE WINDOW Form_2
return
*--------------
function TestLabelValue


	altd()
	// close form_2 manually before next step!

	msgbox(Form_2.Label_1.Value)
return
Call second window and press button to call TestLabelValue() function
This function recalls debugger

( links below contains pictures illustating situations - I can't place these screenshots in another way now...)

https://dysk.onet.pl/link/Vck6R#

Now - close Form_2 window by clicking X
https://dysk.onet.pl/link/K402d

And now - Use GO function in debugger

https://dysk.onet.pl/link/7qP0S

Debugger crashes because manipulating with application forms is allowed...


It's only programmer problem, but, would be fine if such a situation could be disabled

User avatar
srvet_claudio
Posts: 1943
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 30 times
Been thanked: 117 times
Contact:

Post by srvet_claudio » Thu May 05, 2016 3:11 pm

mol wrote:Sorry for my bad English, I want to place sample and some screenshots to illustrate what about I'm thinking.
First - Run this sample in debugger mode:

Code: Select all

/*
 * HMG - Harbour Win32 GUI library
 * Copyright 2002-2008 Roberto Lopez <mail.box.hmg@gmail.com>
 * http://www.hmgforum.com//
*/

#include "hmg.ch"

Function Main()

set century on
set date ital

   DEFINE WINDOW Form_1 ;
      AT 0,0 ;
      WIDTH 400 ;
      HEIGHT 200 ;
      MAIN;
      TITLE 'Test'

      @ 30,70 BUTTON Button_1 CAPTION "Run test" WIDTH 200 HEIGHT 50 ACTION CallForm2()
   
   END WINDOW

   CENTER WINDOW Form_1

   ACTIVATE WINDOW Form_1

Return
*--------------
FUNCTION CallForm2
 
	DEFINE WINDOW Form_2 ;
	  AT 0,0 ;
      WIDTH 400 ;
      HEIGHT 200 ;
      TITLE 'second window...';
      MODAL

      @ 10,10 LABEL LABEL_1 VALUE "This is only label..."
      @ 30,70 BUTTON Button_1 CAPTION "CALL DEBUGGER ALTD()" WIDTH 200 HEIGHT 50 ACTION TestLabelValue()
   
   END WINDOW

   CENTER WINDOW Form_2

   ACTIVATE WINDOW Form_2
return
*--------------
function TestLabelValue


	altd()
	// close form_2 manually before next step!

	msgbox(Form_2.Label_1.Value)
return
Call second window and press button to call TestLabelValue() function
This function recalls debugger

( links below contains pictures illustating situations - I can't place these screenshots in another way now...)

https://dysk.onet.pl/link/Vck6R#

Now - close Form_2 window by clicking X
https://dysk.onet.pl/link/K402d

And now - Use GO function in debugger

https://dysk.onet.pl/link/7qP0S

Debugger crashes because manipulating with application forms is allowed...


It's only programmer problem, but, would be fine if such a situation could be disabled
Hi Marek,

I can hardly reproduce the error, these are the right steps:

1) In debugger press Animate Button --> activate form_1 (line 27)
2) Press "Run Test "--> activate form_2 (line 47)
3) Press "CALL DEBUGGER ALTD()"
4) Close MsgBox() (line 56)
5) Close form_2 (click X)
6) In debugger press Go Button

If you eliminate the AltD() function of the source code, the bug persist ?

PD: AltD() is only for Harbour debugger (console mode)
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com

User avatar
mol
Posts: 2828
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 118 times
Been thanked: 62 times
Contact:

Post by mol » Thu May 05, 2016 5:04 pm

There is no big problem with this "bug". I must to use debugger in this new way...
Old, ALTD() function also calls your debugger and it's fine ;-) :-)

User avatar
srvet_claudio
Posts: 1943
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 30 times
Been thanked: 117 times
Contact:

Post by srvet_claudio » Thu May 05, 2016 8:42 pm

mol wrote:There is no big problem with this "bug". I must to use debugger in this new way...
Old, ALTD() function also calls your debugger and it's fine ;-) :-)
Please, insert this code in your .prg file and test it:

Code: Select all

PROCEDURE AltD()
   HMG_Debugger():Pause()
RETURN

I have not documented the HMG Debugger class, but you can invoke the debugger from your source code, for example:

Code: Select all


#pragma /b+ // this directive force to compile this file in debug mode

#include "hmg.ch"

FUNCTION MAIN
Local cFileName := ProcFile( 0 )  // this file
Local nLine := 69   // line of code 
Private  nCount := 0

IF .not. HMG_Debugger():IsValidStopLine( cFileName, nLine )
   nLine := HMG_Debugger():GetNextValidStopLineEx( cFileName, nLine )
ENDIF
HMG_Debugger():BreakPointToggle( cFileName, nLine )

   DEFINE WINDOW Form1 ;
      AT 0,0 ;
      WIDTH 640 HEIGHT 480 ;
      TITLE 'Main Window' ;
      MAIN 

      @ 200,250 BUTTON Button_1 CAPTION 'ProcTest' ACTION ProcTest()

/*
HMG_Debugger():Go()
HMG_Debugger():Step()
HMG_Debugger():Animate()
HMG_Debugger():Pause()
HMG_Debugger():Trace()
HMG_Debugger():SetCBTrace( lCBTrace ) 

HMG_Debugger():SetToCursor( cFileName, nLine )
HMG_Debugger():Quit()
HMG_Debugger():Exit()

HMG_Debugger():GetNextValidStopLine( nProcLevel )
HMG_Debugger():GetNextValidStopLineEx( cFileName, nLine )
HMG_Debugger():IsValidStopLine( cFileName, nLine )

HMG_Debugger():BreakPointCount()
HMG_Debugger():IsBreakPoint( cFileName, nLine )
HMG_Debugger():BreakPointToggle( cFileName, nLine )
HMG_Debugger():BreakPointDelete( nPos )
HMG_Debugger():BreakPointDeleteAll()
HMG_Debugger():BreakPointAddFunc( cFuncName )

HMG_Debugger():GetExprValue( xExpr, lValid )
HMG_Debugger():WatchCount()
HMG_Debugger():WatchDeleteAll()
HMG_Debugger():WatchDelete( nWatch )
HMG_Debugger():WatchGetInfo( nWatch )
HMG_Debugger():WatchSetExpr( nWatch, cExpr )
HMG_Debugger():WatchPointAdd( cExpr )
HMG_Debugger():TracepointAdd( cExpr )

...
other methods
*/

HMG_Debugger():TracepointAdd( "nCount == 2" )   // add Trace point 


HMG_Debugger():BreakPointToggle()   // Toggle BreakPoint in the following line of code of this file


Form1.TITLE := "BreakPoin 1"




Form1.TITLE := "BreakPoin 2"


   END WINDOW
   CENTER WINDOW Form1
   ACTIVATE WINDOW Form1

RETURN NIL



PROCEDURE ProcTest
   nCount++
   MsgDebug ("ProcTest", nCount)
RETURN

When it is not compiled in the form of debugging, HMG ignores calls the functions of the debugger and therefore do not need to remove them from your source code.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com

User avatar
srvet_claudio
Posts: 1943
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 30 times
Been thanked: 117 times
Contact:

Post by srvet_claudio » Thu May 05, 2016 9:46 pm

srvet_claudio wrote:
mol wrote:Sorry for my bad English, I want to place sample and some screenshots to illustrate what about I'm thinking.
First - Run this sample in debugger mode:

Code: Select all

/*
 * HMG - Harbour Win32 GUI library
 * Copyright 2002-2008 Roberto Lopez <mail.box.hmg@gmail.com>
 * http://www.hmgforum.com//
*/

#include "hmg.ch"

Function Main()

set century on
set date ital

   DEFINE WINDOW Form_1 ;
      AT 0,0 ;
      WIDTH 400 ;
      HEIGHT 200 ;
      MAIN;
      TITLE 'Test'

      @ 30,70 BUTTON Button_1 CAPTION "Run test" WIDTH 200 HEIGHT 50 ACTION CallForm2()
   
   END WINDOW

   CENTER WINDOW Form_1

   ACTIVATE WINDOW Form_1

Return
*--------------
FUNCTION CallForm2
 
	DEFINE WINDOW Form_2 ;
	  AT 0,0 ;
      WIDTH 400 ;
      HEIGHT 200 ;
      TITLE 'second window...';
      MODAL

      @ 10,10 LABEL LABEL_1 VALUE "This is only label..."
      @ 30,70 BUTTON Button_1 CAPTION "CALL DEBUGGER ALTD()" WIDTH 200 HEIGHT 50 ACTION TestLabelValue()
   
   END WINDOW

   CENTER WINDOW Form_2

   ACTIVATE WINDOW Form_2
return
*--------------
function TestLabelValue


	altd()
	// close form_2 manually before next step!

	msgbox(Form_2.Label_1.Value)
return
Call second window and press button to call TestLabelValue() function
This function recalls debugger

( links below contains pictures illustating situations - I can't place these screenshots in another way now...)

https://dysk.onet.pl/link/Vck6R#

Now - close Form_2 window by clicking X
https://dysk.onet.pl/link/K402d

And now - Use GO function in debugger

https://dysk.onet.pl/link/7qP0S

Debugger crashes because manipulating with application forms is allowed...


It's only programmer problem, but, would be fine if such a situation could be disabled
Hi Marek,

I can hardly reproduce the error, these are the right steps:

1) In debugger press Animate Button --> activate form_1 (line 27)
2) Press "Run Test "--> activate form_2 (line 47)
3) Press "CALL DEBUGGER ALTD()"
4) Close MsgBox() (line 56)
5) Close form_2 (click X)
6) In debugger press Go Button

If you eliminate the AltD() function of the source code, the bug persist ?

PD: AltD() is only for Harbour debugger (console mode)
Hi Marek,
I investigated your code, is not a bug is the normal behavior of Windows, change your function for this function and see the comments:

Code: Select all

Function TestLabelValue

   MsgInfo(" If you close Form_2 at this point by clicking on X box" + hb_eol() +; 
           " it is equivalent to call Form_2.RELEASE at this point" + hb_eol() +;
           " and consequently the following code ( Form_2.Label_1.Value ) is invalid") 

   HMG_Debugger():Pause() // the program stop at this point
   
   IF IsWindowDefined( Form_2 )
      MsgInfo( Form_2.Label_1.Value )
   ELSE
      MsgInfo("Error: Form_2 is released")
   ENDIF
   
Return
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com

User avatar
Rathinagiri
Posts: 5160
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 127 times
Been thanked: 128 times
Contact:

Post by Rathinagiri » Fri May 06, 2016 4:19 am

Nice Claudio. I think you can document some portion of HMGDebugger() for effective use of the debugger from inside source code.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
srvet_claudio
Posts: 1943
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 30 times
Been thanked: 117 times
Contact:

Post by srvet_claudio » Fri May 06, 2016 4:51 am

Rathinagiri wrote:Nice Claudio. I think you can document some portion of HMGDebugger() for effective use of the debugger from inside source code.
Yes, I have to document this class!
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com

User avatar
mol
Posts: 2828
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 118 times
Been thanked: 62 times
Contact:

Post by mol » Fri May 06, 2016 5:23 am

Thank you, Claudio!

User avatar
danielmaximiliano
Posts: 2035
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 82 times
Been thanked: 11 times
Contact:

Post by danielmaximiliano » Fri May 06, 2016 8:16 pm

srvet_claudio wrote:
Rathinagiri wrote:Nice Claudio. I think you can document some portion of HMGDebugger() for effective use of the debugger from inside source code.
Yes, I have to document this class!
Buenisimo
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

Post Reply