HMG Beginner

New members who wish to post and participate in HMG Forum, please introduce yourselves in this forum by starting a new thread.

Moderator: Rathinagiri

User avatar
vierirom
Posts: 22
Joined: Sat Aug 20, 2011 3:49 pm
Location: Rome, Italy

Re: HMG Beginner

Post by vierirom »

Hi Rathinagiri and all the forum people.
I'm new of the forum and are a lot of days that I'm trying to understand HMG IDE.
My Name is Vieri and I'm from Italy.
Well, With HMG I was able to understand and, also to build some very small application (I'm still using Clipper 5.2e and started almost in 1983 !!!) so I'm trying to do something with Harbour and HMG.
May I put a question to wich I'm looking around ?
The problem is:
While My application is answering to the user events (clicks here and there) It should also put (meanwhile) some data on com ports and listen for some replyes in the background.
I tried to figure out 3 possible ways:
1- the idle state (no Idle state is detected while the program is running)
2- generate a new kind of event triggered by ? (i don't know)
3- use the multithreading (is it feasible?)
There is always one problem I'm not able to overcome.
Every procedure/function is always called from an "event" generated by user inputs. The behaviour I need is not triggered by any event.
While the normal program executes (answering to all classical events generated by mouse, keyboard etc), It should send some byte to the com port, listen for (if any) replay and, if there is a replay, send a message (update) a specific control (Label.refresh)
Thank you for the time you'll take to answer.

Vieri
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: HMG Beginner

Post by Rathinagiri »

Hi Vieri,

I have great pleasure to welcome you to this forum. As a HMG Poster, now you can post anywhere in the forum.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: HMG Beginner

Post by Rathinagiri »

Now, coming to your question:

I think you can use the 'timer' control to trigger an event or call a function in regular intervals.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
vierirom
Posts: 22
Joined: Sat Aug 20, 2011 3:49 pm
Location: Rome, Italy

Re: HMG Beginner

Post by vierirom »

Hi Rathinagiri.

You... Great !
Thank you so much for the "trick".
As usual, the answes to our questions are just in front of us and we don't want to look at them! :)
It works ! It's just what I'm looking for !
There is always one solution for everything... Just you have to study ... study... and ... study... more and more.
It's about 28 years I'm studying .... it's never enough !
Thank you again
Please forward the thanks also to Roberto Lopez and the others contributors for the very very well job done !
Vieri
p.s. It was about 2 weeks I'm looking for this trick and you can't figure out how many hours I spent searching the net !!!!
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: HMG Beginner

Post by Rathinagiri »

I am happy that I was able to help you Vieri.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
mixmasterisk
Posts: 1
Joined: Mon Aug 22, 2011 2:27 am
Location: usa
Contact:

Test, just a test

Post by mixmasterisk »

:-)
User avatar
vierirom
Posts: 22
Joined: Sat Aug 20, 2011 3:49 pm
Location: Rome, Italy

Re: HMG Beginner

Post by vierirom »

Hi to Everybody.
Is it there someone (Rathinagiri or Esgici or anybody that have an answer) that can help me ? :D
I use the IDE
I'm tryng to modify build.bat (hmg 3.0.40) to obtain:
1- no outorun after build
2- to copy the executable file in another folder and run the executable from that location but...

The first parameter passed to build.bat is always /n even if I put in ide configuration tab the run=no | yes
Reading the build.bat the default value for "runafterbuild" = .t.
more over some lines after I read:
if "%1"=="/n" set runafterbuild=.f.
if "%1"=="/n" shift
so, since %1 is always /n runafterbuild should be .f.
If I comment out the last lines of build bat
<if "%runafterbuild%"==".t." if exist %~n1.exe %~n1.exe>
the application start anyway
Where is my mistake ?
Sorry for the time you'll spend for me.
thank you in advance
Vieri
User avatar
danielmaximiliano
Posts: 2611
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: HMG Beginner

Post by danielmaximiliano »

vierirom wrote:Hi to Everybody.
Is it there someone (Rathinagiri or Esgici or anybody that have an answer) that can help me ? :D
I use the IDE
I'm tryng to modify build.bat (hmg 3.0.40) to obtain:
1- no outorun after build
2- to copy the executable file in another folder and run the executable from that location but...

The first parameter passed to build.bat is always /n even if I put in ide configuration tab the run=no | yes
Reading the build.bat the default value for "runafterbuild" = .t.
more over some lines after I read:
if "%1"=="/n" set runafterbuild=.f.
if "%1"=="/n" shift
so, since %1 is always /n runafterbuild should be .f.
If I comment out the last lines of build bat
<if "%runafterbuild%"==".t." if exist %~n1.exe %~n1.exe>
the application start anyway
Where is my mistake ?
Sorry for the time you'll spend for me.
thank you in advance
Vieri
look at this:

Code: Select all

@echo off
Rem Mybuild.bat
cls
Title New HMG -- Build.bat -- 
SET HMGPATH=c:\HMG.3.0.40
SET Backup=%PATH%
@echo 
if "%1"=="" goto Input                                                                                                                                        
if not EXIST %1 Goto Noexist

:Build  
@Echo Compiling %*                                                                            
call %HMGPATH%build.bat %*
@echo.
goto Finish

:Noexist
echo  El archivo %1  no existe,  revise el nombre
@echo  
Goto Finish

:Input
SET HMGPATH=e:\hmg.3.0.40\
Color 04
@echo ********************************************************************************
@echo  This batch passes information to compile hbmk2 for easy and clean
@echo  is distributed as is and does not guarantee error-free
@echo  if you find one you can write danielmaximiliano@yahoo.com.ar
@echo  Based on a distributed Build.bat HMG Roberto Lopez Project          
@echo ********************************************************************************
@echo.
@echo Enter the name of the project to compile, assumes the extension .HBP if it exists
@echo in the project folder , but will compile the file .PRG
@echo. 
@echo "<Enter>" Batch leaves
@echo.
color 07
Set /p Filename=Name of Application:=
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.

if {%Filename%}=={} goto :Finish
if EXIST %Filename%.hbp (Set Extension=.hbp&&Goto Enterparameters)
if EXIST %Filename%.prg (Set Extension=.prg&&Goto Enterparameters)
goto Cleanvar


:EnterParameters
@echo *******************************************************************************
@echo  Extras parameters to compile %Filename%%extension%
@echo. 
@echo                           /n	Do not run after compile
@echo                           /d	enable DEBUG
@echo                           /c	Mode D.O.S CONSOLE 
@echo. 
@echo Note: " With  <Enter> no parameter is passed"
@echo *******************************************************************************
@echo.
Set /p Parameter=Parameters :=
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
If "%Parameter%"== "" goto Continue
If /I "%Parameter%"=="/n" Goto Withparameters
If /I "%Parameter%"=="/d" Goto Withparameters
If /I "%Parameter%"=="/c" Goto Withparameters
cls
Goto EnterParameters


:Withparameters
@echo compiling with parameters
if EXIST %Filename%.hbp Goto HBPParameters 
if EXIST %Filename%.prg Goto PRGParameters
goto Cleanvar



:HBPParameters
@Echo compiling %Filename%.hbp %Parameter%
call %HMGPATH%build.bat  %filename%.hbp %Parameter%
goto Cleanvar

:PRGParameters
Echo compiling %Filename%.PRG %Parameter%
call %HMGPATH%build.bat %filename%.prg %Parameter%
goto Cleanvar


:Continue
@echo no parameters compilation
if EXIST %Filename%.hbp Goto HBP 
if EXIST %Filename%.prg Goto PRG


:HBP
@Echo Compile %Filename%.hbp
call %HMGPATH%build.bat %filename%.hbp 
goto Cleanvar

:PRG
@Echo Compile %Filename%.prg
call %HMGPATH%build.bat %filename%.prg
goto Cleanvar

:CleanVar
@echo Cleaning variable´s
(SET HMGPATH=)
(SET Filename=)
(SET Parameter=)
Goto Input 

:Finish
SET PATH=%Backup%;;%HMGPATH%\mingw\bin
@echo Cleaning variable´s
set "bar="
set "percent=0"
set "count=0"
for /l %%i in (1,1,20) do set "bar=!bar!±"
:loop
set /p "= %bar:~0,20% %percent%%%"<nul
ping -n 1 -w 1 localhost>nul
for /l %%i in (1,1,26) do set /p "="<nul
set "bar=Û%bar%"
set /a "count+=1"
set /a "percent+=5"
if %count% leq 20 goto:loop
echo.
echo.
(SET HMGPATH=)
(SET Filename=)
(SET Parameter=)
(set bar=)
(set percent=)
(set count=)
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
vierirom
Posts: 22
Joined: Sat Aug 20, 2011 3:49 pm
Location: Rome, Italy

Re: HMG Beginner

Post by vierirom »

Hi danielMaximiliano.
Thank you for the replay.

Looking at "mybuild.bat", you sent me, seems that i have to call this file from OUTSIDE of the hmg IDE.
Isn't it ?
I'm asking about the possibility to change the behaviour of build.bat but leaving the functionality of "Build & run" command from IDE.
The HMG IDE calls the Build.bat, but Run the executable in any case ... (even if the last lines of build.bat are comment out) Why ?
The tooltip of the configuration tab of IDE shows :
gui|mt|picshared|nulrdd|nodefgt|debug|opt|map|strip|hbcppmm|winuni|implib|run|inc=[yess|no]
If you see, of the many choices mutually exclusive, there is also a "run=no" among many possibilities but seems don't working.
Thank You.
Vieri
User avatar
danielmaximiliano
Posts: 2611
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: HMG Beginner

Post by danielmaximiliano »

vierirom wrote:Hi danielMaximiliano.
Thank you for the replay.

Looking at "mybuild.bat", you sent me, seems that i have to call this file from OUTSIDE of the hmg IDE.
Isn't it ?
I'm asking about the possibility to change the behaviour of build.bat but leaving the functionality of "Build & run" command from IDE.
The HMG IDE calls the Build.bat, but Run the executable in any case ... (even if the last lines of build.bat are comment out) Why ?
The tooltip of the configuration tab of IDE shows :
gui|mt|picshared|nulrdd|nodefgt|debug|opt|map|strip|hbcppmm|winuni|implib|run|inc=[yess|no]
If you see, of the many choices mutually exclusive, there is also a "run=no" among many possibilities but seems don't working.
Thank You.
Vieri
Examinador de Proyecto [SET.png
Examinador de Proyecto [SET.png (13.87 KiB) Viewed 5640 times
build.bat receives the parameters correctly.
was added a few lines in Build.bat

Code: Select all

rem *******************************************************************************
rem PROCESS PARAMETERS 
rem *******************************************************************************
rem
rem	/n	no run after build
rem	/d	enabled debugger
rem	/c	console mode
rem

	if "%1"=="/n" set runafterbuild=.f.
	if "%1"=="/n" shift

	if "%1"=="/d" set gtdrivers=-gtwin -gtgui
	if "%1"=="/d" set debug=-b
	if "%1"=="/d" echo options norunatstartup > init.cld
	if "%1"=="/d" shift

	if "%1"=="/c" set gtdrivers=-gtwin -gtgui
	if "%1"=="/c" shift

echo %runafterbuild% >run.txt
echo %*  >>run.txt

run.txt this file is generated in the application folder
run.png
run.png (24.37 KiB) Viewed 5640 times
I'm looking at where failure build.bat
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

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