HMG 3.1.4

HMG Unicode versions 3.1.x related

Moderator: Rathinagiri

Post Reply
Carlos Britos
Posts: 245
Joined: Sat Aug 02, 2008 5:03 pm

Re: HMG 3.1.4 (Test)

Post by Carlos Britos »

Hi.
the below attachments, capture and exe are on Xp.
The exe is not an HMG code but the related function SetCuebanner() is Almost identical. The exe is just to show the behaviour. The exe wwas compiled with harboour 3.2 and bcc but is the same with MinGW. Unicode and Ansi.
Attachments
capture in XP
capture in XP
CAP1.png (4.48 KiB) Viewed 5098 times
cue.zip
exetest
(1.07 MiB) Downloaded 242 times
Regards/Saludos, Carlos (bcd12a)
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 »

Hi Carlos, thank you for your patience and contribution. But your exe here in WinXP SP2 lamentably not working...
Screen95.PNG
Screen95.PNG (12.29 KiB) Viewed 5095 times
Shall be SP2/SP3 the problem ?

In Win7 is working perfectly.
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: Shall be SP2/SP3 the problem ?
In Win7 is working perfectly.
Maybe I have sp3
Regards/Saludos, Carlos (bcd12a)
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 »

And for Spinner and ComboBox did not worked in HMG (even in Win7) and also not for EDITBOX, RICHEDITBOX (these last two, you said already not working).
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 »

Rathinagiri wrote:CueBanner is supported in XP as declared in MSDN here.

http://msdn.microsoft.com/en-us/library ... 85%29.aspx

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!?
Yes Rathi, I also have found this... but I still do not understanding. I guess something in C:\hmg.3.1.4\MINGW\include\commctrl.h where COMCTL32_VERSION is declare to 5 or 6... but this is in MINIGW.
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:And for Spinner and ComboBox did not worked in HMG (even in Win7) and also not for EDITBOX, RICHEDITBOX (these last two, you said already not working).
Remember combobox and spinner are specials controls, two or more in one.
The combobox has listbox + textbox or label and spinner has updown + textbox.
To set the cuebanner you need the handle of the edit part. The textbox of combobox or spinner.
Regards/Saludos, Carlos (bcd12a)
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:Remember combobox and spinner are specials controls, two or more in one.
The combobox has listbox + textbox or label and spinner has updown + textbox.
To set the cuebanner you need the handle of the edit part. The textbox of combobox or spinner.
Ahhh yes, you are right. I do not know how to do it, I will continue searching...

Code: Select all

#include <hmg.ch>

Function Main
Define window Form_1 at 0, 0 width 400 height 300 main Title "Demo2 - Carlos example"
	DEFINE TEXTBOX Text_1
        ROW    10
        COL    10
        WIDTH  200
    END TEXTBOX

    DEFINE TEXTBOX Text_2
        ROW    40
        COL    10
        WIDTH  200
    END TEXTBOX

    DEFINE EDITBOX Edit_1
        ROW    10
        COL    230
        WIDTH  120
        HEIGHT 110
        VALUE ""
    END EDITBOX

    DEFINE COMBOBOX Combo_1
        ROW    70
        COL    10
        WIDTH  200
        HEIGHT 100
        ITEMS {"Item 1","Item 2","Item 3"}
        VALUE 0
    END COMBOBOX

    DEFINE SPINNER Spinner_1
        ROW    100
        COL    10
        WIDTH  200
        HEIGHT 24
        RANGEMIN 1
        RANGEMAX 10
        VALUE 0
    END SPINNER

    DEFINE RICHEDITBOX RichEdit_1
        ROW    130
        COL    230
        WIDTH  120
        HEIGHT 90
        VALUE ""
    END RICHEDITBOX
End window
SetTextBoxCueBanner("Form_1","Text_1","Enter your name here")
SetTextBoxCueBanner("Form_1","Text_2","Enter address here")

SetTextBoxCueBanner("Form_1","Spinner_1","Spinner CueBanner")
SetTextBoxCueBanner("Form_1","Combo_1","ComboBox CueBanner")

SetTextBoxCueBanner("Form_1","Edit_1","EditBox CueBanner")
SetTextBoxCueBanner("Form_1","RichEdit_1","RichEditBox CueBanner")
Form_1.center
Form_1.activate
Return Nil

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

Setcuebanner(nHandle,cText,.t.) // Third parameter is for not dissapear when getfocus
Return Nil

#pragma BEGINDUMP

#define COMPILE_HMG_UNICODE
#include <HMG_UNICODE.h>

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

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

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) hb_parl(3), (LPARAM) (LPCWSTR) lpWCStr ) ;
   SysFreeString( lpWCStr );
}

#pragma ENDDUMP
May you try to correct this code for us ?

Probably for EditBox and RichEditBox would exist a way for do it too...
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 »

Please try with code
Note that:
in spinner GetControlHandle() return an array. So SetTextBoxCueBanner() need a trick to work.
in combobox I'm using FindWindowEx( GetControlHandle( "Combo_1", "Form_1" ), 0, "Edit", Nil ) to get the handle of textbox.
Probably for EditBox and RichEditBox would exist a way for do it too...
Probably, I'd tried time ago but with no luck, sorry.

Code: Select all

#include <hmg.ch>

Function Main
Define window Form_1 at 0, 0 width 400 height 300 main Title "Demo2 - Carlos example"
   DEFINE TEXTBOX Text_1
        ROW    10
        COL    10
        WIDTH  200
    END TEXTBOX

    DEFINE TEXTBOX Text_2
        ROW    40
        COL    10
        WIDTH  200
    END TEXTBOX

    DEFINE EDITBOX Edit_1
        ROW    10
        COL    230
        WIDTH  120
        HEIGHT 110
        VALUE ""
    END EDITBOX

    DEFINE COMBOBOX Combo_1
        ROW    70
        COL    10
        WIDTH  200
        HEIGHT 100
        ITEMS {"Item 1","Item 2","Item 3"}
        VALUE 0
        DISPLAYEDIT .T.      // must be .T. for cuebanner
    END COMBOBOX

    DEFINE SPINNER Spinner_1
        ROW    100
        COL    10
        WIDTH  200
        HEIGHT 24
        RANGEMIN 1
        RANGEMAX 10
        VALUE 0
    END SPINNER

    DEFINE RICHEDITBOX RichEdit_1
        ROW    130
        COL    230
        WIDTH  120
        HEIGHT 90
        VALUE ""
    END RICHEDITBOX
End window

SetTextBoxCueBanner("Form_1","Text_1","Enter your name here")
SetTextBoxCueBanner("Form_1","Text_2","Enter address here")

// SetTextBoxCueBanner("Form_1","Spinner_1","Spinner CueBanner")
// SetTextBoxCueBanner("Form_1","Combo_1","ComboBox CueBanner")

Setcuebanner(FindWindowEx( GetControlHandle( "Combo_1", "Form_1" ), 0, "Edit", Nil ),"ComboBox CueBanner",.f.)
Setcuebanner( GetControlHandle( "Spinner_1", "Form_1" )[1],"Spinner CueBanner",.f.)

SetTextBoxCueBanner("Form_1","Edit_1","EditBox CueBanner")
SetTextBoxCueBanner("Form_1","RichEdit_1","RichEditBox CueBanner")

Form_1.center
Form_1.activate
Return Nil

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

Setcuebanner(nHandle,cText,.f.)
Return Nil

#pragma BEGINDUMP

#define COMPILE_HMG_UNICODE
#include <HMG_UNICODE.h>

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

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

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) hb_parl(3), (LPARAM) (LPCWSTR) lpWCStr ) ;
   SysFreeString( lpWCStr );
}

#pragma ENDDUMP

Regards/Saludos, Carlos (bcd12a)
Carlos Britos
Posts: 245
Joined: Sat Aug 02, 2008 5:03 pm

Re: HMG 3.1.4 (Test)

Post by Carlos Britos »

Hi Pablo

En MSDN I saw this comment:
wParam option note

wParam TRUE - only appears to work on Vista.

Under XP the cue text always disappears when the control gets focus regardless of this parameter.
Stanley Roark
4/13/2009
Can you try if this is true for us ?
Maybe is the problem with sp2
Regards/Saludos, Carlos (bcd12a)
User avatar
srvet_claudio
Posts: 2220
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG 3.1.4 (Test)

Post by srvet_claudio »

Remember combobox and spinner are specials controls, two or more in one.
The combobox has listbox + textbox or label and spinner has updown + textbox.
To set the cuebanner you need the handle of the edit part. The textbox of combobox or spinner.
Hi boys,
this is how to get all handles of a control:

Code: Select all

hControl := GetControlHandle (cControlName, cParentName)

IF Valtype (hControl) == "A"
    FOR i = 1 TO LEN(hControl)
        ControlHandle := hControl [i]
        ProcessControlHandle (ControlHandle)
    NEXT
ELSE
    ControlHandle := hControl
    ProcessControlHandle (ControlHandle)
ENDIF


Procedure ProcessControlHandle (ControlHandle)
   // code for process ControlHandle
Return
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
Post Reply