HMG 3.1.4

HMG Unicode versions 3.1.x related

Moderator: Rathinagiri

Post Reply
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG 3.1.4 (Test)

Post by srvet_claudio »

Pablo, recent I understand your question.
I said:
srvet_claudio wrote:SETCUEBANNER of the HMG.3.1.4, works also in ANSI because this portion of the code is forced to compile always in Unicode.
because in the changelog.txt says CueBanner only works in Unicode.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

HMG 3.1.4 (Test)

Post by Pablo César »

There is something wrong comparing Rathi example with Carlos one. I have dried Rathis codes. I have changed includes and defines original positions and I cut off following lines:

Code: Select all

#include "hbapi.h"
#include <tchar.h>
#include <wingdi.h>
and

Code: Select all

#define Edit_SetCueBannerText(hwnd, lpcwText) \
   (BOOL)SNDMSG((hwnd), EM_SETCUEBANNER, 0, (LPARAM)(lpcwText))
#define   EM_GETCUEBANNER       (ECM_FIRST + 2)      // Set the cue banner with the lParm = LPCWSTR
#define Edit_GetCueBannerText(hwnd, lpwText, cchText) \
   (BOOL)SNDMSG((hwnd), EM_GETCUEBANNER, (WPARAM)(lpwText), (LPARAM)(cchText))
See dried source code:

Code: Select all

#include <hmg.ch>

Function Main
Define window Form_1 at 0, 0 width 400 height 300 main
	
	Define TextBox name
		Row 10
		Col 10
        Width 200
    End Textbox
    
	Define TextBox address
       Row 40
       Col 10
       Width 200
    End Textbox
End window
SetTextBoxCueBanner("Form_1","name","Enter your name here")
SetTextBoxCueBanner("Form_1","address","Enter address here")
Form_1.center
Form_1.activate
Return Nil

Function SetTextBoxCueBanner(cParent,cControl,cText)
Local nHandle := GetControlHandle(cControl,cParent)

// _SetTextBoxCueBanner(nHandle,cText)
Setcuebanner(nHandle,cText)
Return Nil

#pragma BEGINDUMP

#include <HMG_UNICODE.h>
#include <windows.h>
#include <commctrl.h>

#define COMPILE_HMG_UNICODE

// #define _WIN32_IE      0x0500
// #define _WIN32_WINNT   0x0501

#define ECM_FIRST          0x1500          // Edit control messages
#define EM_SETCUEBANNER   (ECM_FIRST + 1)  // Set the cue banner with the lParm = LPCWSTR

HB_FUNC ( _SETTEXTBOXCUEBANNER )
{
   HWND hWnd1;
   hWnd1 = (HWND) hb_parnl (1);
   SendMessage((HWND) hWnd1,EM_SETCUEBANNER, (WPARAM)(int) 1,(LPARAM) HMG_parc(2) );
}

HB_FUNC( SETCUEBANNER )   // ( editHandle, cMsg ) -> nil
{
   #ifdef UNICODE
      LPWSTR lpWCStr = HMG_parc(2) ;
   #else
      LPWSTR lpWCStr = (LPCWSTR) ( hb_parc(2) == NULL ) ? NULL : hb_mbtowc( (const char *) hb_parc(2) ) ;
   #endif
   SendMessage( (HWND) hb_parnl(1), EM_SETCUEBANNER, (WPARAM) 0, (LPARAM) (LPCWSTR) lpWCStr ) ;
   SysFreeString( lpWCStr );
}

#pragma ENDDUMP
With this code is coming japonese characters... what I have done wrong ? (see my example there both samples: Rathi + Carlos ones).

I have ordered before includes then declares constants and seems stop working (see below source cod). Probably this happing due a duplicity of var declarations. By on the other hand, in same code, Carlos example works properly in WIN7 even with includes before declares...

Anyway, both of examples is not working in XP. :(
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Carlos Britos
Posts: 245
Joined: Sat Aug 02, 2008 5:03 pm

Re: HMG 3.1.4 (Test)

Post by Carlos Britos »

Pablo César wrote:
Carlos, what do you mean about #ifdef IGH_UNICODE (here in red is it something wrong ?)

Pablo, change:

Code:
#ifdef IGH_UNICODE
for:
Code:
#ifdef UNICODE

Hi this is because is not a HMG code, I´ve extracted from another code, and I forget to remove it.

Hola Claudio
Es porque no es un codigo HMG y olvidé borrarlo. Es parte de un codigo que tengo hecho.

Regards/Saludos, Carlos (bcd12a)
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG 3.1.4 (Test)

Post by srvet_claudio »

Pablo César wrote: #pragma BEGINDUMP

#include <HMG_UNICODE.h>
#include <windows.h>
#include <commctrl.h>

#define COMPILE_HMG_UNICODE
Pablo, this always should be:

Code: Select all

#pragma BEGINDUMP            <---- first line

#define COMPILE_HMG_UNICODE  <---- second line
#include "HMG_UNICODE.h"     <---- third line

...
#include <windows.h>
...
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG 3.1.4 (Test)

Post by srvet_claudio »

Carlos Britos wrote:
Pablo César wrote:
Carlos, what do you mean about #ifdef IGH_UNICODE (here in red is it something wrong ?)

Pablo, change:

Code:
#ifdef IGH_UNICODE
for:
Code:
#ifdef UNICODE

Hi this is because is not a HMG code, I´ve extracted from another code, and I forget to remove it.

Hola Claudio
Es porque no es un codigo HMG y olvidé borrarlo. Es parte de un codigo que tengo hecho.

Gracias Carlos.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: HMG 3.1.4 (Test)

Post by Pablo César »

srvet_claudio wrote:Pablo, this always should be:

Code: Select all

#pragma BEGINDUMP            <---- first line

#define COMPILE_HMG_UNICODE  <---- second line
#include "HMG_UNICODE.h"     <---- third line

...
#include <windows.h>
...
Thank you Claudio, this is the right way, very much appreciated and important instruction. Now is working for WIN7 but still not in WinXP.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

HMG 3.1.4 (Test)

Post by Pablo César »

Carlos Britos wrote:Hi this is because is not a HMG code, I´ve extracted from another code, and I forget to remove it.

Hola Claudio
Es porque no es un codigo HMG y olvidé borrarlo. Es parte de un codigo que tengo hecho.
Yes Carlos, but the good thing is working for HMG UNICODE and ANSI too. Of course is not working for WinXP.

I liked more Rathi example, because it is only dissapear the cue text by using keyboard when we start typing. But in Carlos example when we get in focus of TextBox its dissapear. By the other hand seems Carlos example works with rest of others components, which it will be useful. I think we can keep both as example for next release.

The bad thing, both examples are not working in XP... :(
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
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 3.1.4 (Test)

Post by Rathinagiri »

Hi Pablo,

The behaviour is optional. You have to change WPARAM to 0 or 1 to change the behaviour of your choice.

SendMessage((HWND) hWnd1,EM_SETCUEBANNER, (WPARAM)(int) 1,(LPARAM) HMG_parc(2) );

or

SendMessage((HWND) hWnd1,EM_SETCUEBANNER, (WPARAM)(int) 0,(LPARAM) HMG_parc(2) );

CueBanner is supported in XP as declared in MSDN here.

http://msdn.microsoft.com/en-us/library ... 85%29.aspx
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 3.1.4 (Test)

Post by Rathinagiri »

And as the MSDN suggests,

"Note To use this API, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see Enabling Visual Styles."

We have a manifest file in HMG Resource path. But how to enable!?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

HMG 3.1.4 (Test)

Post by Pablo César »

Rathinagiri wrote:The behaviour is optional. You have to change WPARAM to 0 or 1 to change the behaviour of your choice.

SendMessage((HWND) hWnd1,EM_SETCUEBANNER, (WPARAM)(int) 1,(LPARAM) HMG_parc(2) );

or

SendMessage((HWND) hWnd1,EM_SETCUEBANNER, (WPARAM)(int) 0,(LPARAM) HMG_parc(2) );
Ohhh thank you Rathi, I had not seen that differance in parameter. This we could let it optional for users. So I will teste for other components and revert.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply