Page 1 of 1
A funny sample
Posted: Fri Apr 23, 2010 12:39 pm
by esgici
Hi All
I'm not sure, this is funny or not, useful or not; only a little experiment on HMG power.
"Warn Lazy User" is a function (procedure) and is embedded in famous HMG sample Main.Demo.
Why Main Demo? Because I like much this sample, in my opinion this is "father" of all HMG sample; almost everything included in and as possible as simple and intuitive way
"Warn Lazy User" have some missing points; but surely may complete in the future.
Enjoy !
Regards, saludos
--
Esgici
Re: A funny sample
Posted: Fri Apr 23, 2010 12:55 pm
by Rathinagiri
Very interesting.

Re: A funny sample
Posted: Fri Apr 23, 2010 2:15 pm
by esgici
Hi All
Please change line 1276 from
Code: Select all
Form_1.Label_3.Value := SECTOTIME( nElapTime )
to
Code: Select all
Form_1.Label_3.Value := SECTOTIME( nWaitIddleInterval - nElapTime )
Regards, saludos
--
Esgici
Re: A funny sample
Posted: Fri Apr 23, 2010 2:52 pm
by Rathinagiri
Also add in Line 724
Code: Select all
if valtype(color[1]) == "U" .or. valtype(color[2]) == "U" .or. valtype(color[3]) == "U"
return nil
endif
Re: A funny sample
Posted: Fri Apr 23, 2010 2:55 pm
by Rathinagiri
It is really a proud that, HMG can do all these things.
Just 1306 (most of them are empty lines) lines and a FULL FLEDGED DEMO. HMG is just great man.
Unfortunately Misc->ShellAbout() function gives run time error.

Re: A funny sample
Posted: Fri Apr 23, 2010 8:38 pm
by esgici
Hi Rathi
Rathi wrote:Also add in Line 724
My suggestion for
GetColor_Click() :
Code: Select all
PROC GetColor_Click()
*-----------------------------------------------------------------------------*
LOCAL aColor := GetColor()
IF HB_ISNIL( aColor[ 1 ] ) // It's impossible any element is not-nil when one is nil
MsgInfo( "Escaped")
ELSE
MsgInfo( Str(aColor[1]) , "Red Value")
MsgInfo( Str(aColor[2]) , "Green Value")
MsgInfo( Str(aColor[3]) , "Blue Value")
ENDIF
RETU // GetColor_Click()
*-----------------------------------------------------------------------------*
Rathi wrote:Unfortunately Misc->ShellAbout() function gives run time error.
My suggestion for
ShelAbout() is :
Code: Select all
ITEM 'ShellAbout() Function (Contributed by Manu Exposito' ACTION ;
ShellAbout( "About Main Demo" + "#" + ;
"HMG Main Demo", ;
"GUI Library For Harbour" + CRLF + ;
"HMG Power Ready!" )
IMHO this is a little older function and something been changed out of HMG
By the way, I have slightly modified
SetPict() procedure too; did you noticed ?
Rathi wrote:It is really a proud that, HMG can do all these things.
Just 1306 (most of them are empty lines) lines and a FULL FLEDGED DEMO. HMG is just great man.
You are absolutely right; this causing why I like very much this sample

and HMG of course
Viva HMG, viva Roberto Lopez !
Regards, saludos
--
Esgici
Re: A funny sample
Posted: Fri Apr 23, 2010 10:20 pm
by Czarny_Pijar
Unwanted miracles happen ...
In order not to wait too long, please make these changes
Code: Select all
#define nWaitIddleInterval 2 // In seconds, 2= Accelerating. Line 10
* PLAY WAVE 'Alarm.WAV' // Mute not to go crazy. Line 1280
and see what happens.
In my case, the application crawls off the screen!
Re: A funny sample
Posted: Fri Apr 23, 2010 10:37 pm
by esgici
Czarny_Pijar wrote:
In my case, the application crawls off the screen!
For a purpose like "crawling off the screen" may find countless methods
Why 2, instead of zero ?
I'm glad by giving you an miraculous toy
Regards
--
Esgici
Re: A funny sample
Posted: Fri Apr 23, 2010 11:13 pm
by Czarny_Pijar
Symptoms are funny, but the problem is serious.
Looking at the program, I see the intention : The frame should be shaking in one place.
Certainly should
not crawl off somewhere, but
it does.
This unwanted(?) behavior can be easily removed:
Code: Select all
*-----------------------------------------------------------------------------*
PROC Vibrate()
*-----------------------------------------------------------------------------*
LOCA nElapTime := SECONDS() - nLastActTime,;
nWinRow := Form_1.Row ,;
nWinCol := Form_1.Col
Form_1.Label_3.Value := SECTOTIME( nWaitIddleInterval - nElapTime )
IF nElapTime > nWaitIddleInterval
PLAY WAVE 'Alarm.WAV'
FOR y := 1 TO 5
FOR x := 1 TO 3
Form_1.Row := nWinRow - x
Form_1.Col := nWinCol - x
NEXT x
FOR x := 1 TO 3
Form_1.Row := nWinRow + x * 2
Form_1.Col := nWinCol + x * 2
NEXT x
FOR x := 1 TO 3
Form_1.Row := nWinRow - x
Form_1.Col := nWinCol - x
NEXT x
NEXT y
Form_1.Row := nWinRow //------------ added
Form_1.Col := nWinCol //------------ added
ResetWarnTime()
ENDIF
RETU
Re: A funny sample
Posted: Sat Apr 24, 2010 12:16 am
by esgici
Thanks to your interest and attention
Regards
--
Esgici