Page 4 of 5

Re: Win_Msg - A kind of Notification message so easy and friendly Demo

Posted: Wed Mar 22, 2017 1:50 pm
by quartz565
Ευχαριστώ φίλε !

Win_Msg - A kind of Notification message so easy and friendly Demo

Posted: Wed Mar 22, 2017 2:05 pm
by Pablo César
ΠΑΡΑΚΑΛΩ :D

You are welcome Dave.

Re: Win_Msg - A kind of Notification message so easy and friendly Demo

Posted: Thu Mar 23, 2017 12:30 pm
by Anand
Hi Pablo,

I got below error, obviously thread lib needed. How to add it ?

Harbour 3.2.0dev (r1601151502)
Copyright (c) 1999-2015, http://harbour-project.org/
<snip>
hbmk2: Error: Referenced, missing, but unknown function(s):
GETCURRENTTHREADID(), GETCURRENTTHREADHANDLE(), SETTHREADPRIORITY(),
ATTACHTHREADINPUT(), HMG_THREADHBTOWINID()

Regards,

Anand

Win_Msg - A kind of Notification message so easy and friendly Demo

Posted: Thu Mar 23, 2017 12:52 pm
by Pablo César
Hello Anand,

As you can see at source Demo3.prg saying: Compiled with...: HMG 3.4.3 + added patches #1 and #2

I think patch #2 is missing to be added at your HMG. See this: viewtopic.php?p=50091#p50091 and please considere also this: viewtopic.php?p=50218#p50218

Now in HMG Harbour and C functions be added to work with THREADs properlly thanks to Dr. Claudio. :)

Re: Win_Msg - A kind of Notification message so easy and friendly Demo

Posted: Thu Mar 23, 2017 4:05 pm
by Anand
Thanks Pablo,

Patched and done :D

Regards,

Anand

Re: Win_Msg - A kind of Notification message so easy and friendly Demo

Posted: Fri Mar 24, 2017 12:49 pm
by serge_girard
Hi Pablo,

I changed a bit:

Code: Select all

nHeight := LEN(cMsg) * 1.3
IF nHeight < 82 
   nHeight  := 82
ENDIF
nTop := GetDesktopRealHeight() - nHeight
For longer text messages. Maybe there is a better way to do it?
Thanks for nice piece of handy messaging, it looks really professional now !

Serge

Re: Win_Msg - A kind of Notification message so easy and friendly Demo

Posted: Fri Mar 24, 2017 5:05 pm
by RPC
Hi Pablo
I am getting following error while compiling
Errror.png
Errror.png (49.98 KiB) Viewed 4645 times
Pls advice what is to be done.
Thanks

Re: Win_Msg - A kind of Notification message so easy and friendly Demo

Posted: Fri Mar 24, 2017 5:23 pm
by Anand
Hi RPC

Patch it. See http://hmgforum.com/viewtopic.php?p=50240#p50217 for Pablo's answer.

Regards,

Anand

Win_Msg - A kind of Notification message so easy and friendly Demo

Posted: Fri Mar 24, 2017 6:37 pm
by Pablo César
serge_girard wrote: Fri Mar 24, 2017 12:49 pm Hi Pablo,

I changed a bit:

Code: Select all

nHeight := LEN(cMsg) * 1.3
IF nHeight < 82 
   nHeight  := 82
ENDIF
nTop := GetDesktopRealHeight() - nHeight
For longer text messages. Maybe there is a better way to do it?
Thanks for nice piece of handy messaging, it looks really professional now !

Serge
Nice idea Serge. :) :P
I guess there is better way to calculate number of lines, specially when CRLF is introduced in the cMsg.
I tried a bit more with this code... but unsuccessfuly... :oops:

Code: Select all

cMsg := "Printing file xxxxx.xxx "+CRLF+"sent to EPSON LX-300"+CRLF+"3rd line"+CRLF+"4th line"+CRLF+"5th line"

FUNCTION Notifier( cMsg, aBcolor, nSeconds, lCenter, nTransparency )
LOCAL cParentWindowName, hWnd, hWndhMain := 0
LOCAL nWidth := 204, nTimeIni
LOCAL nLeft := GetDesktopRealWidth() - nWidth

LOCAL nLines, hFont, nTop, nHeight, nMsgWidth
LOCAL cFontName := "MS Shell Dlg"
LOCAL nFontSize := 10
LOCAL lBold := .T., lItalic := .F., lUnderline := .F., lStrikeOut := .F.

DEFAULT cMsg          := ""
DEFAULT nSeconds      := 2
DEFAULT lCenter       := .F.
DEFAULT nTransparency := 255

If Empty(cMsg)
   Return Nil
Endif

*nHeight := HMG_Len(cMsg) * 1.3

nLines := hb_TokenCount(cMsg, .T. /*lEOL*/)
hFont := HMG_CreateFont ( , cFontName, nFontSize, lBold, lItalic, lUnderline, lStrikeOut )

nMsgWidth := GetTextWidth( , cMsg, hFont)
nMsgWidth := nMsgWidth / (nWidth - 20)
If !( Int(nMsgWidth/(nWidth - 20)) == nMsgWidth )
   nMsgWidth := Int( nMsgWidth ) + 1
Endif

nLines := nLines + nMsgWidth

nHeight := XGetTextHeight( , cMsg, hFont) * nLines
I borrow some Krzysztof's function... but I got tired to try... :|

RPC wrote: Fri Mar 24, 2017 5:05 pm I am getting following error while compiling
Hi Rajeev,

Probably you did not applied yet the two patches of 3.4.3 version as it said already Anand. (By the way: thank you Anand).
It's incomplete info in your screen captured.

As a result of this lack of visibility, let me know something:
have you already tested the ViewError - HMG building utility ? For me it's useful, if not for you may you tell me what did you dislike about it ?

Re: Win_Msg - A kind of Notification message so easy and friendly Demo

Posted: Sat Mar 25, 2017 8:48 am
by serge_girard
Yes, Pablo I used a quick and dirty method. Perhaps CRLF should be count as a complete line.
Also yesterday I added an image (kind of company logo) so I'm testing it with your new code from above.

Serge