prg code function documentor in HMG

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: prg code function documentor in HMG

Post by AUGE_OHR »

since Console Output is so slow i want to make a GUI Version.
HMG_Click_GUI.jpg
HMG_Click_GUI.jpg (45.87 KiB) Viewed 9556 times
i try EDITBOX (WC_EDIT multi-line ) as Output

Code: Select all

   cDummy := GetProperty("ClickForm","InBox","Value")
   cDummy += CRLF
   cDummy += cData
   SetProperty("ClickForm","InBox","Value",cDummy)
but than Memory grow up until it crash
Unrecoverable error 9006: hb_xgrab can't allocate memory
hm ... it was the Way i use under Clipper (Memo) / Xbase++ (XbpMLE) but here it "react" in other Way

YES i do "reset" Memory in procedure TheAligner() when Code is "Output"

so how can i show cData (it is one Line) under GUI ... :idea:
it does not make sence to "fill" a Control when action is just some Seconds

Code: Select all

procedure show_in( cData )
procedure show_out(cData ... )
procedure centertext( cSomeText ... )
here is the FMG (only) which i use now
ClickForm.zip
(768 Bytes) Downloaded 312 times
p.s. Time raise from 2 Seconds to 20 Seconds but that would be OK when i "see" Code ...
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: prg code function documentor in HMG

Post by AUGE_OHR »

hi

now i try this

Code: Select all

PUBLIC cStatusBox := ""
PUBLIC cInBox     := ""
PUBLIC cOutBox    := ""
so i have 3 PUBLIC

in Function i use SetProperty() which work ... BUT Memory increase !

Souce is less than 250 Kb but Memory grow up over 1 GB. :shock:
if i disable SetProperty() ( VERBOSE=NO in Click.INI) i have no Memory Problem :!:

so what is the Problem with SetProperty() :?:

Code: Select all

procedure show_in( cData )
if lVerbose
 #IFDEF Use_Gui
   IF VAL(cData) > 0
   ELSE
      cInBox  += cData
      SetProperty("ClickForm","InBox","Value",cInBox  )
      SetProperty("ClickForm","InBox","CaretPos", -1 )
      cInBox  += CRLF
   ENDIF
 #ELSE
   scroll( 9, 1, nMidScreen - 1, maxcol() - 1, 1 )
   @ nMidScreen - 1, 2 say left( cData, maxcol() - 4 )
 #ENDIF
endif
return

Code: Select all

procedure show_out( cData, cColor )
if lVerbose
 #IFDEF Use_Gui
   cOutBox  += cData
   SetProperty("ClickForm","OutBox","Value",cOutBox)
   SetProperty("ClickForm","OutBox","CaretPos", -1 )
   cOutBox  += CRLF
 #ELSE
   default cColor to 'W+/B'
   scroll( nMidScreen + 1, 1, maxrow() - 3, maxcol() - 1, 1 )
   @ maxrow() - 3, 2 say left( cData, maxcol() - 4 ) color cColor
 #ENDIF
endif
return

Code: Select all

procedure centertext( cSomeText, nLineNumber, cColor )
 #IFDEF Use_Gui
   cStatusBox += cSomeText
   SetStatusText()
 #ELSE
   @ nLineNumber, ( maxcol() - len( cSomeText ) ) / 2 say cSomeText color cColor
 #ENDIF
return

Code: Select all

PROCEDURE SetStatusText()
   SetProperty("ClickForm","StatusBox","Value",cStatusBox)
   SetProperty("ClickForm","StatusBox","CaretPos", -1 )
   cStatusBox += CRLF
RETURN
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: prg code function documentor in HMG

Post by AUGE_OHR »

hi,

have try to use API with WM_SETTEXT

Code: Select all

PROCEDURE SetStatusText(cData)
LOCAL ControlHandle

   cStatusBox += cData
*   SetProperty("ClickForm","StatusBox","Value","")
*   SetProperty("ClickForm","StatusBox","Value",cStatusBox)
*   SetProperty("ClickForm","StatusBox","CaretPos", -1 )
*   ClickForm.StatusBox.Value    := ""
*   ClickForm.StatusBox.Value    := cStatusBox
*   ClickForm.StatusBox.CaretPos := -1

   ControlHandle := GetControlHandle("StatusBox", "ClickForm")
   IF !EMPTY(ControlHandle)
*     DllCall("user32.dll",DLL_OSAPI,"SendMessageA"  ,;
*                                   ControlHandle  ,;
*                                   WM_SETTEXT     ,;
*                                   LEN(cStatusBox),;
*                                   cStatusBox      )
*     DllCall("user32.dll",DLL_OSAPI,"InvalidateRect",ControlHandle  ,1)

      SendMessage(ControlHandle  ,;
                  WM_SETTEXT     ,;
                  LEN(cStatusBox),;
                  cStatusBox      )
      InvalidateRect (ControlHandle, NIL ,.F.)
   ENDIF

   cStatusBox += CRLF
RETURN
but it does not show anything ... hm

funny also a have 3 x Editbox but it does not show Text when run "normal"
using Debugger you can "see" that it work but not without Debugger ... :(
HMG_Click_DLLcall.jpg
HMG_Click_DLLcall.jpg (225.83 KiB) Viewed 9542 times
does someone have a Tip how to update a Editbox without lose Memory :idea:
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: prg code function documentor in HMG

Post by AUGE_OHR »

hi

i got API running :D
HMG_Click_DLLcall2.jpg
HMG_Click_DLLcall2.jpg (60.86 KiB) Viewed 9509 times

Code: Select all

     DllCall("user32.dll",DLL_OSAPI,"SendMessageA"  ,;
                                   ControlHandle  ,;
                                   WM_SETTEXT     ,;
                                   LEN(cStatusBox),;
                                   cStatusBox      )
*     DllCall("user32.dll",DLL_OSAPI,"InvalidateRect",ControlHandle  ,1)

*      SendMessage(ControlHandle  ,;
*                  WM_SETTEXT     ,;
*                  LEN(cStatusBox),;
*                  cStatusBox      )
      InvalidateRect (ControlHandle, NIL ,.F.)
my 1st DLLcall work while harbour Version fail :?:
my 2nd Dllcall fail while harbour Version work :!:
now Memory does not increase and i can "see" Output :D

BUT ... it begin Quick but with every line it get slower and slower ... :(
when got to next PRG ist start again with "full speed" and than slow down.

i know that 32 Bit Apps will get slower when reach 2 GB Limit but i'm far away from Memory Limit now.
as Console show same it must be a serious Problem with harbour which i don't understand.

---

it does have 3 x EditBox where i want "Output".
it "seem" me that Graphic is "at Limit" an all goes to Queue.
it is like a "Cache". when it is "full" it slow down.

App is so "busy" that you NOT allowed to switch to other App while than it will not show Output any more.
it seems to "stop" when "lost Focus". you just can wait until End or break it.

does some "Sleep" or "DoEvent" help in this Case :idea:

it is is NOT the Code while when using

Code: Select all

VERBOSE=NO
in Click.INI it take less than 5 Seconds to do the Work.

---

what about Thread for each EditBox. how do i "sync" Thread under harbour / HMG :?:
Thread "Input" read Data and "wait" until Thread "Output" is ready to "receive" data.
is the a Sample which show me how it work :?:

as usual here is full Source of Project.
hb_CLICK_2055.ZIP
(60.71 KiB) Downloaded 341 times
please help me to find "Speed" for "Output"
have fun
Jimmy
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: prg code function documentor in HMG

Post by serge_girard »

Jimmy,

hbxpp.hbc MUST be in HBP file!

Serge
There's nothing you can do that can't be done...
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: prg code function documentor in HMG

Post by AUGE_OHR »

hi,
serge_girard wrote: Mon Dec 09, 2019 1:24 pm hbxpp.hbc MUST be in HBP file!
sorry i don't understand.
i write LIBS into "Configuration" of IDE, is this wrong :?:
Configuration_LIBs.jpg
Configuration_LIBs.jpg (29.56 KiB) Viewed 9465 times
never-less HMG have a own "DllCall" so i will try to find out how it work so we can get rid of HbXpp.
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: prg code function documentor in HMG

Post by AUGE_OHR »

hi,

did someone have a Idea why "output" is get slow down even in Console :?:
have fun
Jimmy
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: prg code function documentor in HMG

Post by edk »

Hi.
I changed the control type from EDITBOX to RICHEDITBOX and used the Addtext property.
Every 250 lines displayed, release memory and do event queue.
click_prg.7z
(18.82 KiB) Downloaded 359 times
Check it now.
User avatar
danielmaximiliano
Posts: 2611
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: prg code function documentor in HMG

Post by danielmaximiliano »

Falta
2019-12-10 13_11_05-Build Log.png
2019-12-10 13_11_05-Build Log.png (25.07 KiB) Viewed 9426 times
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: prg code function documentor in HMG

Post by AUGE_OHR »

hi,
danielmaximiliano wrote: Tue Dec 10, 2019 4:11 pm Falta
2019-12-10 13_11_05-Build Log.png
sorry that i have use Xbase++ Style and DLL.CH which is not Part of HMG

Code: Select all

#ifndef _DLL_CH
#define _DLL_CH

#define DLL_CDECL                   0x08
#define DLL_STDCALL                 0x20
#define DLL_SYSTEM                  0x04
#if defined( __PLATFORM__WINDOWS )
#define DLL_OSAPI                   DLL_STDCALL
#elif defined( __PLATFORM__OS2 )
#define DLL_OSAPI                   DLL_SYSTEM
#else
#define DLL_OSAPI                   DLL_CDECL
#endif

/* Only for compatiblity.
   Harbour always copies the string to a temporary buffer. */
#define DLL_CALLMODE_COPY           0
#define DLL_CALLMODE_NORMAL         DLL_CALLMODE_COPY

#endif /* _DLL_CH */
have fun
Jimmy
Post Reply